/* ============================================================
   لوحة نجيك — تصميم موحّد
   الهوية: برتقالي نجيك #E05A26 + رمادي الشعار #474F59
   ============================================================ */

:root {
    /* الهوية */
    --brand: #E05A26;
    --brand-strong: #C94E1F;
    --brand-soft: #FBEEE6;
    --brand-softer: #FDF6F1;
    --ink: #343B44;          /* رمادي الشعار للنصوص الأساسية */
    --ink-strong: #23282F;
    --muted: #79818C;
    --faint: #A6ACB5;

    /* الأسطح */
    --bg: #F6F5F2;
    --card: #FFFFFF;
    --line: #E9E6E1;
    --line-strong: #DCD8D2;
    --hover: #F8F6F3;

    /* دلالات */
    --success: #1D8A57;      --success-soft: #E6F4EC;
    --danger: #C43D3D;       --danger-soft: #FBEAEA;
    --warning: #A87514;      --warning-soft: #FBF3E0;
    --info: #2563C9;         --info-soft: #E9F0FB;
    --indigo: #5856C4;       --indigo-soft: #EDEDFA;
    --orange: #C05621;       --orange-soft: #FBEDE3;

    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 1px 2px rgba(35, 40, 47, .05);
    --shadow-lg: 0 10px 32px rgba(35, 40, 47, .14);

    --sidebar-w: 258px;
    --topbar-h: 60px;

    --table-font-size: 13px;
    --table-head-padding: 10px 14px;
    --table-cell-padding: 10px 14px;
    --table-toolbar-block-padding: 14px;

    --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --brand: #F07842;
    --brand-strong: #FF9A68;
    --brand-soft: #3A241B;
    --brand-softer: #271C17;
    --ink: #D9DDE2;
    --ink-strong: #F2F4F6;
    --muted: #9BA3AE;
    --faint: #737C87;
    --bg: #111417;
    --card: #191D21;
    --line: #2A3037;
    --line-strong: #38404A;
    --hover: #22272D;
    --success: #55C98D;      --success-soft: #173529;
    --danger: #EE7373;       --danger-soft: #3A2022;
    --warning: #E3B957;      --warning-soft: #382F1C;
    --info: #75A7F5;         --info-soft: #1B2B43;
    --indigo: #9694F0;       --indigo-soft: #282741;
    --orange: #ED9561;       --orange-soft: #3B271D;
    --shadow: 0 1px 2px rgba(0, 0, 0, .26);
    --shadow-lg: 0 14px 36px rgba(0, 0, 0, .42);
}

html[data-theme="dark"] table.dt th { background: #161A1E; }
html[data-theme="dark"] .nav-item.active .nav-count { background: #2B211D; }
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .dt-pages button.current,
html[data-theme="dark"] .seg-btn.active,
html[data-theme="dark"] .cat-card-eye:hover,
html[data-theme="dark"] .cat-tog.is-basic {
    color: #fff;
}
html[data-theme="dark"] .btn-primary svg,
html[data-theme="dark"] .dt-pages button.current svg,
html[data-theme="dark"] .seg-btn.active svg,
html[data-theme="dark"] .cat-card-eye:hover svg,
html[data-theme="dark"] .cat-tog.is-basic svg {
    color: #fff;
    stroke: currentColor;
}
html[data-theme="dark"] .alert-success { border-color: #285A42; }
html[data-theme="dark"] .alert-danger { border-color: #653234; }

html[data-density="compact"] {
    --table-font-size: 12px;
    --table-head-padding: 6px 10px;
    --table-cell-padding: 5px 10px;
    --table-toolbar-block-padding: 9px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--ink-strong); margin: 0; font-weight: 600; }

/* ============ الهيكل العام ============ */

.shell { min-height: 100vh; }

.content-area {
    margin-right: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-right .22s ease;
}

.page {
    padding: 24px 34px 48px;
    width: 100%;
    margin: 0;
    flex: 1;
}

@media (min-width: 1700px) {
    .page { padding-left: 48px; padding-right: 48px; }
}

/* ============ الشريط الجانبي ============ */

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--card);
    border-left: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform .22s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 20px 18px;
    border-bottom: 1px solid var(--line);
}

/* الشعار وردمارك عريض (بعد قص الحواف) — يملأ عرض القائمة */
.sidebar-brand img { width: 82%; max-width: 200px; height: auto; display: block; }
.sidebar-brand .brand-logo-dark { display: none; }
html[data-theme="dark"] .sidebar-brand .brand-logo-light { display: none; }
html[data-theme="dark"] .sidebar-brand .brand-logo-dark { display: block; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

.nav-section {
    margin: 18px 6px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--faint);
    letter-spacing: .3px;
}

.nav-section:first-child { margin-top: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 500;
    transition: background .12s ease, color .12s ease;
}

.nav-item:hover { background: var(--hover); text-decoration: none; }

.nav-item.active {
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 600;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 1.8;
    color: var(--muted);
}

.nav-item.active svg { color: var(--brand); }

.nav-item .nav-count {
    margin-right: auto;
    font-size: 11px;
    background: var(--bg);
    color: var(--muted);
    border-radius: 99px;
    padding: 0 8px;
    line-height: 18px;
}

.nav-item.active .nav-count { background: #fff; color: var(--brand-strong); }

.sidebar-foot {
    border-top: 1px solid var(--line);
    padding: 12px 16px;
    font-size: 11.5px;
    color: var(--faint);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.sidebar-foot-rights {
    direction: ltr;
    unicode-bidi: isolate;
}

/* ============ الشريط العلوي ============ */

.topbar {
    height: var(--topbar-h);
    background: var(--card);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 26px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-title { font-size: 15px; font-weight: 600; color: var(--ink-strong); }

.topbar-spacer { flex: 1; }

.topbar-chat-link {
    position: relative;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
}

.topbar-chat-link:hover,
.topbar-chat-link.is-active {
    background: var(--hover);
    border-color: var(--line);
    text-decoration: none;
}

.topbar-chat-link svg {
    width: 18px;
    height: 18px;
}

.topbar-chat-badge {
    top: -2px;
    inset-inline-end: -3px;
}

.molak-panel-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn.molak-panel-link {
    background: #0F766E;
    border-color: #0F766E;
    color: #fff;
}

.btn.molak-panel-link:hover {
    background: #0B5F59;
    border-color: #0B5F59;
    color: #fff;
}

.molak-sidebar-link {
    background: #0F766E;
    border: 1px solid #0F766E;
    color: #fff;
}

.molak-sidebar-link:hover {
    background: #0B5F59;
    border-color: #0B5F59;
    color: #fff;
}

.molak-sidebar-link svg,
.molak-sidebar-link .molak-panel-link-logo {
    color: #fff;
}

.molak-panel-link-logo {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    object-fit: contain;
}

.burger {
    display: none;
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ink);
}

/* قائمة المستخدم */
.user-menu { position: relative; }

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-family: inherit;
}

.user-menu-btn:hover { background: var(--hover); }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-meta { text-align: right; line-height: 1.3; }
.user-meta .name { font-size: 13px; font-weight: 600; color: var(--ink-strong); }
.user-meta .role { font-size: 11px; color: var(--muted); }

.dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 190px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
    z-index: 60;
}

.dropdown.open { display: block; }

.dropdown a, .dropdown button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    text-align: right;
}

.dropdown a:hover, .dropdown button:hover { background: var(--hover); text-decoration: none; }
.dropdown .danger { color: var(--danger); }
.dropdown hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }

/* ============ ترويسة الصفحة ============ */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.page-head h1 { font-size: 19px; }

.page-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ البطاقات ============ */

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

.card-pad { padding: 18px 20px; }

.card-head {
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.card-head h2 { font-size: 14.5px; }

/* صفوف الرسوم البيانية */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 18px;
    align-items: start;
}

.charts-row .card { min-width: 0; }

@media (max-width: 1024px) {
    .charts-row { grid-template-columns: 1fr; }
}

[data-chart] svg { display: block; max-width: 100%; }

/* شريط المؤشرات — معالجة تحريرية هادئة بلا بطاقات أو ألوان */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0;
    margin-bottom: 24px;
    border-block: 1px solid var(--line);
}

.stat {
    position: relative;
    min-width: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 17px 20px 16px;
    display: flex;
    align-items: flex-start;
    gap: 0;
}

.stat:not(:last-child)::after {
    content: '';
    position: absolute;
    inset-inline-end: 0;
    inset-block: 17px;
    width: 1px;
    background: var(--line);
}

.stat-icon { display: none; }

.stat > div:not(.stat-icon) {
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 5px;
    min-width: 0;
}

.stat .num {
    font-size: clamp(22px, 1.8vw, 28px);
    font-weight: 700;
    color: var(--ink-strong);
    line-height: 1;
    text-align: start;
    letter-spacing: -.02em;
}

.stat .lbl {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.35;
    text-align: start;
}

.tone-brand   { background: var(--brand-soft);   color: var(--brand-strong); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-danger  { background: var(--danger-soft);  color: var(--danger); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-info    { background: var(--info-soft);    color: var(--info); }
.tone-indigo  { background: var(--indigo-soft);  color: var(--indigo); }
.tone-orange  { background: var(--orange-soft);  color: var(--orange); }
.tone-muted   { background: var(--bg);           color: var(--muted); }

/* أيقونات البطاقات بلا خلفية وأحادية اللون — تلغي ألوان tone-* لتقليل تعدد الألوان */
.stat-icon,
.stat-icon.tone-brand,
.stat-icon.tone-success,
.stat-icon.tone-danger,
.stat-icon.tone-warning,
.stat-icon.tone-info,
.stat-icon.tone-indigo,
.stat-icon.tone-orange,
.stat-icon.tone-muted {
    background: transparent;
    color: var(--ink-strong);
}

/* رابط نصّي برتقالي صغير بدون خلفية (عرض التفاصيل … إلخ) */
.link-detail {
    background: none;
    border: 0;
    padding: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--brand);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.link-detail:hover { text-decoration: underline; }

/* ============ الأزرار ============ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; }
.btn svg { width: 15px; height: 15px; stroke-width: 2; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }

.btn-outline { background: var(--card); border-color: var(--line-strong); color: var(--ink); }
.btn-outline:hover { background: var(--hover); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #A93434; }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--hover); color: var(--ink); }

.btn-sm { padding: 5px 11px; font-size: 12px; }

.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ============ الشارات ============ */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.7;
}

.pill::before,
.pill::after {
    content: none !important;
    display: none !important;
}
.pill svg {
    width: 13px;
    height: 13px;
    color: currentColor;
    stroke: currentColor;
}
.pill.tone-brand,
.pill.tone-success,
.pill.tone-danger,
.pill.tone-warning,
.pill.tone-info,
.pill.tone-indigo,
.pill.tone-orange,
.pill.tone-muted {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    color: #fff;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .12);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .18),
        inset 0 -10px 18px rgba(0, 0, 0, .08),
        0 8px 18px rgba(0, 0, 0, .10);
}
.pill.tone-brand   { background: linear-gradient(135deg, #F07842 0%, #C94E1F 100%); }
.pill.tone-success { background: linear-gradient(135deg, #21A66B 0%, #116E46 100%); }
.pill.tone-danger  { background: linear-gradient(135deg, #E05757 0%, #A93434 100%); }
.pill.tone-warning { background: linear-gradient(135deg, #D49A24 0%, #8B5C12 100%); }
.pill.tone-info    { background: linear-gradient(135deg, #3B82F6 0%, #1D4EA8 100%); }
.pill.tone-indigo  { background: linear-gradient(135deg, #7775E8 0%, #4542A8 100%); }
.pill.tone-orange  { background: linear-gradient(135deg, #F07842 0%, #B64D1E 100%); }
.pill.tone-muted   { background: linear-gradient(135deg, #737C87 0%, #474F59 100%); }
.pill.tone-brand::after,
.pill.tone-success::after,
.pill.tone-danger::after,
.pill.tone-warning::after,
.pill.tone-info::after,
.pill.tone-indigo::after,
.pill.tone-orange::after,
.pill.tone-muted::after {
    content: none !important;
    display: none !important;
}
.pill[style*="--success"],
.pill[style*="--danger"],
.pill[style*="--warning"],
.pill[style*="--info"],
.pill[style*="--brand"],
.pill[style*="--muted"] {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08) !important;
    color: #fff !important;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .12);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .18),
        inset 0 -10px 18px rgba(0, 0, 0, .08),
        0 8px 18px rgba(0, 0, 0, .10);
}
.pill[style*="--success"] { background: linear-gradient(135deg, #21A66B 0%, #116E46 100%) !important; }
.pill[style*="--danger"]  { background: linear-gradient(135deg, #E05757 0%, #A93434 100%) !important; }
.pill[style*="--warning"] { background: linear-gradient(135deg, #D49A24 0%, #8B5C12 100%) !important; }
.pill[style*="--info"]    { background: linear-gradient(135deg, #3B82F6 0%, #1D4EA8 100%) !important; }
.pill[style*="--brand"]   { background: linear-gradient(135deg, #F07842 0%, #C94E1F 100%) !important; }
.pill[style*="--muted"]   { background: linear-gradient(135deg, #737C87 0%, #474F59 100%) !important; }

/* ============ النماذج ============ */

label { font-size: 12.5px; font-weight: 600; color: var(--ink); display: block; margin-bottom: 5px; }

.input, .select, textarea.input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--ink);
    background: var(--card);
    transition: border-color .12s ease, box-shadow .12s ease;
}

.input:focus, .select:focus, textarea.input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.link-copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 14px;
}

.select { appearance: none; padding-left: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2379818C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 10px center; }

.field-error { color: var(--danger); font-size: 12px; margin-top: 4px; }

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

/* ============ الجدول الموحّد ============ */

.dt-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: var(--table-toolbar-block-padding) 16px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.dt-search { position: relative; min-width: 220px; flex: 0 1 280px; }

.dt-search input { padding-right: 34px; }

.dt-search svg {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--faint);
    stroke-width: 2;
    pointer-events: none;
}

.dt-toolbar .select { width: auto; min-width: 130px; }

.dt-toolbar .wallet-filter-input {
    width: 132px;
    min-width: 116px;
    flex: 0 0 132px;
}

.provider-filter-combo {
    display: inline-flex;
    align-items: center;
    height: 34px;
    min-width: 150px;
    flex: 0 0 150px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--card);
    transition: border-color .12s ease, box-shadow .12s ease, flex-basis .12s ease, min-width .12s ease;
}

.provider-filter-combo:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.provider-filter-combo.is-custom {
    min-width: 232px;
    flex-basis: 232px;
}

.provider-filter-combo select,
.provider-filter-combo input {
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-family: inherit;
    font-size: 13px;
}

.provider-filter-combo select {
    min-width: 148px;
    padding: 0 12px 0 34px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2379818C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
}

.provider-filter-combo input {
    width: 0;
    min-width: 0;
    padding: 0;
    opacity: 0;
    color: var(--ink-strong);
    border-inline-start: 1px solid transparent;
    transition: width .12s ease, opacity .12s ease, padding .12s ease;
}

.provider-filter-combo.is-custom input {
    width: 82px;
    padding: 0 8px;
    opacity: 1;
    border-inline-start-color: var(--line);
}

.dt-reset {
    width: 34px;
    height: 32px;
    padding: 0;
    justify-content: center;
}
.dt-reset svg { width: 15px; height: 15px; }

.dt-total { margin-right: auto; font-size: 12px; color: var(--muted); }

.dt-wrap { overflow-x: auto; }

table.dt {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--table-font-size);
}

table.dt th {
    text-align: right;
    padding: var(--table-head-padding);
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: #FBFAF8;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    user-select: none;
}

table.dt th.sortable { cursor: pointer; }
table.dt th.sortable:hover { color: var(--ink); }

table.dt th .arrow { font-size: 10px; margin-right: 3px; opacity: 0; }
table.dt th.sorted .arrow { opacity: 1; color: var(--brand); }

table.dt td {
    padding: var(--table-cell-padding);
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

table.dt tbody tr:hover { background: var(--hover); }
table.dt tbody tr:last-child td { border-bottom: none; }

.satisfaction-stars {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    direction: ltr;
    vertical-align: middle;
    white-space: nowrap;
}

.satisfaction-star {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    line-height: 1;
}

.satisfaction-star svg {
    width: 13px;
    height: 13px;
}

.satisfaction-star.is-active {
    color: #d4a017;
}

.satisfaction-star.is-empty {
    color: rgba(148, 163, 184, 0.45);
}

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

.dt-empty svg { width: 38px; height: 38px; color: var(--faint); stroke-width: 1.4; margin-bottom: 8px; }

.dt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    flex-wrap: wrap;
}

.dt-info { font-size: 12px; color: var(--muted); }

.dt-pages { display: flex; gap: 4px; }

.dt-pages button {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--line-strong);
    background: var(--card);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 12.5px;
    color: var(--ink);
    cursor: pointer;
}

.dt-pages button:hover:not([disabled]) { background: var(--hover); }
.dt-pages button.current { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.dt-pages button[disabled] { opacity: .45; cursor: default; }

.dt-loading td { text-align: center; padding: 40px; color: var(--muted); }

/* مؤشر تحميل */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--line-strong);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============ عناصر صفحة الإشعارات ============ */

.coverage-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    padding: 13px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--muted);
}

.cov-num { font-weight: 700; color: var(--ink-strong); font-variant-numeric: tabular-nums; }

.push-preview {
    background: linear-gradient(160deg, var(--card), var(--bg));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.push-preview-app {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 8px;
}

.push-preview-app img { width: 18px; height: 18px; border-radius: 4px; }

.send-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 16px;
    background: var(--brand-softer);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.send-info { font-size: 13px; color: var(--ink); }

.chip {
    display: inline-block;
    padding: 1px 9px;
    border-radius: 6px;
    background: var(--bg);
    border: 1px solid var(--line);
    font-size: 12px;
    color: var(--ink);
}

/* مربعات اختيار أوضح */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
    cursor: pointer;
    vertical-align: middle;
}

/* ============ أزرار إجراءات الصف ============ */

.row-actions {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    white-space: nowrap;
}

.row-action-trigger {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-strong);
    background: var(--card);
    border-radius: var(--radius-sm);
    color: var(--ink);
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}

.row-action-trigger:hover,
.row-menu.open > .row-action-trigger { background: var(--hover); border-color: var(--muted); }
.row-action-trigger:focus-visible { outline: 2px solid var(--ink-strong); outline-offset: 2px; }
.row-action-trigger svg { width: 14px; height: 14px; }

.icon-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-strong);
    background: var(--card);
    border-radius: var(--radius-sm);
    color: var(--muted);
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}

.icon-btn:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.icon-btn svg { width: 15px; height: 15px; stroke-width: 1.9; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: #F1C9C9; }
.icon-btn.success:hover { background: var(--success-soft); color: var(--success); border-color: #C4E5D3; }
.icon-btn.brand:hover { background: var(--brand-soft); color: var(--brand-strong); border-color: #F5D3C2; }

/* قائمة إجراءات منسدلة داخل الصف (عند كثرة الإجراءات) */
.row-menu { position: relative; display: inline-block; }

.row-menu-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 168px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 5px;
    z-index: 30;
    display: none;
}

.row-menu.open .row-menu-list { display: block; }

.row-menu-list button, .row-menu-list a {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-family: inherit;
    font-size: 12.5px;
    text-align: right;
    cursor: pointer;
    white-space: nowrap;
}

.row-menu-list button:hover, .row-menu-list a:hover { background: var(--hover); text-decoration: none; }
.row-menu-list button.danger, .row-menu-list a.danger { color: var(--danger); }
.row-menu-list button.danger:hover, .row-menu-list a.danger:hover { background: var(--danger-soft); }
.row-menu-list svg { width: 14px; height: 14px; stroke-width: 1.9; color: var(--muted); }
.row-menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 3px; }

/* شريط أدوات مجمّع للإجراءات الجماعية */
.bulk-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--brand-softer);
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.bulk-bar.show { display: flex; }
.bulk-bar .count { font-weight: 600; color: var(--brand-strong); }

/* ============ تبويبات الحالة ============ */

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 0;
}

.tabs a, .tabs button {
    padding: 8px 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}

.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }

.tabs .active {
    color: var(--brand-strong);
    border-bottom-color: var(--brand);
    font-weight: 600;
}

.tabs .tab-count {
    font-size: 11px;
    background: var(--bg);
    border-radius: 99px;
    padding: 1px 7px;
    margin-right: 5px;
    color: var(--muted);
}

.tabs .active .tab-count { background: var(--brand-soft); color: var(--brand-strong); }

/* ============ شبكة بطاقات الأقسام ============ */

.cat-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

@media (max-width: 1400px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1100px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .cat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .cat-grid { grid-template-columns: 1fr; } }

.cat-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow .15s ease, transform .15s ease;
}

.cat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.cat-card-img {
    height: 118px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 8px;
}

/* الصورة كاملة بدون قص */
.cat-card-img img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }

.cat-card-img .no-img {
    color: var(--faint);
    font-size: 12.5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.cat-card-img .no-img svg { width: 30px; height: 30px; stroke-width: 1.4; }

/* زر التعديل بزاوية البطاقة العلوية */
.cat-card-edit {
    position: absolute;
    top: 8px;
    inset-inline-start: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--brand-strong);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(35, 40, 47, .12);
    transition: background .12s;
}

.cat-card-edit:hover { background: #fff; }
.cat-card-edit svg { width: 14px; height: 14px; stroke-width: 1.9; }

.cat-card-badge {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--line);
}
.cat-card-badge,
.cat-card-badge[style*="--success"],
.cat-card-badge[style*="--muted"],
.cat-card-badge[style*="--danger"],
.cat-card-badge[style*="--warning"] {
    isolation: isolate;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .10) !important;
    color: #fff !important;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .12);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .20),
        inset 0 -10px 18px rgba(0, 0, 0, .08),
        0 8px 18px rgba(0, 0, 0, .10);
}
.cat-card-badge[style*="--success"] { background: linear-gradient(135deg, #21A66B 0%, #116E46 100%) !important; }
.cat-card-badge[style*="--muted"]   { background: linear-gradient(135deg, #737C87 0%, #474F59 100%) !important; }
.cat-card-badge[style*="--danger"]  { background: linear-gradient(135deg, #E05757 0%, #A93434 100%) !important; }
.cat-card-badge[style*="--warning"] { background: linear-gradient(135deg, #D49A24 0%, #8B5C12 100%) !important; }
.cat-card-badge:not([style]) { background: linear-gradient(135deg, #21A66B 0%, #116E46 100%) !important; }
.cat-card-badge::after {
    content: '';
    position: absolute;
    inset: 1px 1px auto 1px;
    height: 42%;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0));
    pointer-events: none;
    z-index: -1;
}

.cat-card-body { padding: 10px 12px 12px; }

.cat-card-name { font-weight: 700; color: var(--ink-strong); font-size: 13px; }
.cat-card-name .en { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; margin-top: 1px; }

.cat-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 9px;
    gap: 6px;
}

.cat-card-count { font-size: 11.5px; color: var(--muted); }
.cat-card-count b { color: var(--ink-strong); font-variant-numeric: tabular-nums; }

.cat-card-eye {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    background: var(--brand-soft);
    color: var(--brand-strong);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.cat-card-eye:hover { background: var(--brand); color: #fff; }
.cat-card-eye svg { width: 15px; height: 15px; stroke-width: 1.9; }

/* ============ إعادة ترتيب الخدمات (سحب وإفلات) ============ */

.reorder-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; padding: 2px; }

.reorder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: box-shadow .12s ease, border-color .12s ease, opacity .12s ease;
}

.reorder-item:hover { border-color: var(--line-strong); }
.reorder-item.dragging { opacity: .5; box-shadow: var(--shadow-lg); border-color: var(--brand); }

.reorder-handle {
    display: flex;
    align-items: center;
    color: var(--faint);
    cursor: grab;
    flex-shrink: 0;
}
.reorder-handle:active { cursor: grabbing; }
.reorder-item:hover .reorder-handle { color: var(--muted); }

.reorder-pos {
    flex-shrink: 0;
    min-width: 22px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--brand-strong);
    font-variant-numeric: tabular-nums;
}

.reorder-thumb {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--bg);
    border: 1px solid var(--line);
    flex-shrink: 0;
}
.reorder-thumb.empty { display: inline-block; }

.reorder-info { min-width: 0; flex: 1; }
.reorder-name { font-weight: 600; color: var(--ink-strong); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reorder-price { font-size: 11.5px; color: var(--muted); }

/* ============ قائمة التصدير ============ */

.dt-export-wrap { position: relative; }
.dt-export { display: inline-flex; align-items: center; gap: 5px; }
.dt-export svg { width: 14px; height: 14px; }
.dt-export-menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-start: 0;
    min-width: 160px;
    z-index: 60;
}
.dt-export-menu svg { width: 15px; height: 15px; color: var(--muted); }

/* ============ مرفقات الطلب (مجموعات) ============ */

.attach-group { margin-bottom: 18px; }
.attach-group:last-child { margin-bottom: 0; }
.attach-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 9px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--line);
}
.attach-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.attach-thumbs img {
    width: 74px; height: 74px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    display: block;
}
.attach-thumbs.att-finish img { border: 2px solid var(--success); }
.attach-file {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--ink);
    background: var(--card);
}
.attach-file:hover { background: var(--hover); text-decoration: none; }
.attach-file svg { width: 16px; height: 16px; }

/* ============ منبثقة سبب الإلغاء ============ */

.reason-trigger { cursor: help; display: inline-flex; }
.reason-trigger .pill { position: relative; }
/* مؤشّر صغير يدل على وجود سبب */
.reason-trigger .pill::after {
    content: none !important;
    display: none !important;
}

.reason-pop {
    position: fixed;
    z-index: 200;
    max-width: 320px;
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 10px 12px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
    text-align: right;
}
.reason-pop.open { opacity: 1; }
.reason-pop-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 5px;
}
.reason-pop-body {
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--ink-strong);
    white-space: pre-line;
    word-break: break-word;
}

/* ============ تعديل القسم: مفتاح تبديل ============ */

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; margin-bottom: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
    position: relative;
    width: 40px; height: 22px;
    background: var(--line-strong);
    border-radius: 99px;
    transition: background .15s ease;
    flex-shrink: 0;
}
.switch-thumb {
    position: absolute;
    top: 2px; inset-inline-start: 2px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(35,40,47,.25);
    transition: transform .15s ease;
}
.switch input:checked + .switch-track { background: var(--success); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(-18px); }
.switch-label { font-size: 12.5px; color: var(--ink); }
.switch.sm .switch-track { width: 34px; height: 19px; }
.switch.sm .switch-thumb { width: 15px; height: 15px; }
.switch.sm input:checked + .switch-track .switch-thumb { transform: translateX(-15px); }

/* صورة القسم في صفحة التعديل */
.cat-edit-img {
    width: 100%; height: 140px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; padding: 8px;
}
.cat-edit-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cat-edit-img .no-img { color: var(--faint); font-size: 12.5px; }

/* المدن */
.city-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.city-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    cursor: pointer; font-weight: 500; font-size: 13px;
    transition: background .12s ease, border-color .12s ease;
    margin-bottom: 0;
}
.city-chip:hover { background: var(--hover); }
.city-chip input { accent-color: var(--danger); }
.city-chip:has(input:checked) { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

/* السكشنات */
.section-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 12px;
    background: var(--card);
    overflow: hidden;
}
.section-head {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.section-titles { display: flex; gap: 8px; flex: 1; min-width: 220px; flex-wrap: wrap; }
.section-titles .input { min-width: 140px; flex: 1; }
.section-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-save.has-pending-changes,
.pool-save.has-pending-changes {
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.section-services {
    display: flex; flex-wrap: wrap; gap: 7px; padding: 12px 14px;
    transition: background .12s ease;
}
.section-services.is-sorting,
.pool-list.is-sorting {
    background: var(--brand-softer);
    border-radius: var(--radius-sm);
}

.svc-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 9px;
    background: var(--brand-softer);
    border: 1px solid var(--brand-soft);
    border-radius: 99px;
    font-size: 12.5px; color: var(--ink-strong);
    transition: opacity .12s ease, box-shadow .12s ease;
}
.svc-chip.dragging {
    opacity: .42;
    box-shadow: var(--shadow-lg);
    border-color: var(--brand);
}
.svc-chip-drag { display: inline-flex; color: var(--faint); cursor: grab; }
.svc-chip-drag:active { cursor: grabbing; }
.svc-chip-name { white-space: nowrap; }
.svc-chip-x {
    border: none; background: none; cursor: pointer;
    color: var(--muted); font-size: 16px; line-height: 1;
    padding: 0 2px; border-radius: 4px;
}
.svc-chip-x:hover { color: var(--danger); background: var(--danger-soft); }

.svc-add {
    border: 1px dashed var(--line-strong);
    background: none; color: var(--brand-strong);
    border-radius: 99px; padding: 5px 12px;
    font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.svc-add:hover { background: var(--brand-soft); border-color: var(--brand); }

/* الخدمات غير المُسندة */
.pool-box { margin-top: 8px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--bg); }
.pool-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.pool-count { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 0 8px; font-size: 11px; color: var(--ink); }
.pool-hint { font-size: 11px; font-weight: 500; color: var(--faint); }
.pool-save { margin-inline-start: auto; }
.pool-save:disabled { cursor: not-allowed; opacity: .55; }
.pool-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; margin: -4px; transition: background .12s ease; }
.pool-item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; background: var(--card); border: 1px solid var(--line); border-radius: 99px; font-size: 12px; color: var(--muted); }

/* منتقي الخدمات */
.picker-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 500; margin-bottom: 0; }
.picker-item:hover { background: var(--hover); }

/* ============ الخط الزمني (timeline) ============ */

.timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 0;
}

.timeline-item {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    padding-left: 18px;
}

.timeline-item:not(:last-child)::after {
    content: '';
    width: 22px;
    height: 2px;
    background: var(--line-strong);
    margin: 0 6px;
}

.timeline-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2.5px solid currentColor;
    background: #fff;
}

.timeline-dot.tone-success { color: var(--success); }
.timeline-dot.tone-danger { color: var(--danger); }
.timeline-dot.tone-warning { color: var(--warning); }
.timeline-dot.tone-info { color: var(--info); }
.timeline-dot.tone-indigo { color: var(--indigo); }
.timeline-dot.tone-orange { color: var(--orange); }
.timeline-dot.tone-brand { color: var(--brand); }
.timeline-dot.tone-muted { color: var(--muted); }

.timeline-body {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .timeline { flex-direction: column; align-items: flex-start; }
    .timeline-item::after { display: none; }
    .timeline-item { padding-left: 0; }
}

/* ============ مراحل الطلب ============ */
.ostep-card {
    overflow: hidden;
    border-color: var(--line);
}

.ostep-card .card-head {
    min-height: 48px;
}

.ostep-card .card-pad {
    padding: 22px 24px 18px;
}

.ostep { position: relative; padding: 8px 2px 4px; }

.ostep-track {
    position: absolute;
    top: 25px;
    right: calc(100% / (var(--steps, 6) * 2));
    left: calc(100% / (var(--steps, 6) * 2));
    height: 2px;
    background: var(--line);
    border-radius: 999px;
    z-index: 0;
    overflow: hidden;
}

.ostep-fill {
    position: absolute;
    top: 0; right: 0;
    height: 100%;
    width: 0;
    background: var(--brand);
    border-radius: inherit;
    animation: ostepFill .45s cubic-bezier(.4, 0, .2, 1) .12s forwards;
}

.ostep.is-canceled .ostep-fill { background: var(--danger); }

@keyframes ostepFill { to { width: var(--progress, 0%); } }

.ostep-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(var(--steps, 6), minmax(0, 1fr));
    gap: 6px;
    position: relative;
    z-index: 1;
}

.ostep-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 7px;
    min-width: 0;
    opacity: 1;
    transform: none;
}

.ostep-dot {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border: 1px solid var(--line-strong);
    color: var(--muted);
    box-shadow: 0 0 0 5px var(--card);
    transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
    flex-shrink: 0;
}

.ostep-dot svg { width: 15px; height: 15px; }

.ostep-label { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.35; }
.ostep-date { font-size: 10.5px; color: var(--muted); opacity: .85; direction: ltr; font-variant-numeric: tabular-nums; }
.ostep-hint { font-size: 10.5px; color: var(--brand-strong); font-weight: 700; }

.ostep-step.is-done .ostep-dot { background: var(--card); border-color: var(--brand); color: var(--brand); }
.ostep-step.is-done .ostep-label { color: var(--ink); }

.ostep-step.is-current .ostep-dot {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 0 0 5px var(--brand-soft);
}
.ostep-step.is-current .ostep-label { color: var(--brand-strong); font-weight: 700; }

.ostep-step.is-stopped .ostep-dot {
    background: var(--card);
    border-color: var(--danger);
    color: var(--danger);
    box-shadow: 0 0 0 5px var(--danger-soft);
}
.ostep-step.is-stopped .ostep-label { color: var(--danger); font-weight: 700; }

.ostep-branch {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--hover);
    font-size: 13px;
    font-weight: 700;
}
.ostep-branch svg { width: 18px; height: 18px; flex-shrink: 0; }
.ostep-branch .note { font-weight: 400; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
    .ostep-fill, .ostep-step { animation: none; }
    .ostep-fill { width: var(--progress, 0%); }
    .ostep-step { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
    .ostep-card .card-pad { padding: 18px 14px 14px; overflow-x: auto; }
    .ostep { min-width: 620px; }
    .ostep-dot { width: 30px; height: 30px; }
    .ostep-dot svg { width: 14px; height: 14px; }
    .ostep-track { top: 23px; }
    .ostep-label { font-size: 10px; }
    .ostep-date { display: none; }
}

.map-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--brand-strong);
    line-height: 1.5;
}
.map-link:hover { text-decoration: underline; }
.map-link svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--brand); }

/* رابط موقع الطلب (اسم المدينة → خرائط قوقل) */
.loc-link { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); font-weight: 500; }
.loc-link svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--brand); }
.loc-link:hover { color: var(--brand-strong); text-decoration: none; }
.loc-link:hover span { text-decoration: underline; text-underline-offset: 2px; }

.order-category-cell {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-height: 22px;
    color: var(--ink);
    font-weight: 600;
    line-height: 1.45;
    white-space: nowrap;
    vertical-align: middle;
}

.order-category-cell img {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 4px;
    object-fit: cover;
    display: block;
}

.complaints-table table.dt th:nth-child(3),
.complaints-table table.dt td:nth-child(3) {
    width: 360px;
    max-width: 360px;
}

.complaints-message {
    max-width: 360px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.7;
}

/* ============ رقائق تخصصات الفني ============ */
.cat-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; max-width: 360px; }
.cat-chip {
    display: inline-flex;
    align-items: center;
    font-size: 10.5px;
    font-weight: 500;
    line-height: 1.6;
    padding: 0 7px;
    border-radius: 99px;
    background: var(--bg);
    color: var(--muted);
    border: 1px solid var(--line);
    white-space: nowrap;
}
.cat-chip-basic {
    background: var(--brand-soft);
    color: var(--brand-strong);
    border-color: transparent;
    font-weight: 600;
}
.cat-chip-more { background: var(--hover); cursor: default; }

/* ============ خلية قابلة للضغط (اسم عميل/فني) ============ */
.cell-link {
    background: none; border: none; padding: 0; margin: 0;
    font: inherit; color: var(--ink); cursor: pointer;
    text-align: right; display: inline;
}
.cell-link:hover { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 2px; }

/* ============ مودال المعلومات السريعة ============ */
.qm-loading { text-align: center; color: var(--muted); padding: 28px 0; font-size: 13px; }
.qm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.qm-avatar {
    width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
    background: var(--brand-soft); color: var(--brand-strong);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px;
}
.qm-idwrap { min-width: 0; }
.qm-name { font-size: 15px; font-weight: 600; color: var(--ink-strong); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qm-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.qm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.qm-tile {
    background: var(--bg); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: 10px 8px; text-align: center;
}
.qm-tile-num { font-size: 16px; font-weight: 700; color: var(--ink-strong); }
.qm-tile-lbl { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.qm-sec-title { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.qm-devices { display: flex; flex-direction: column; gap: 8px; }
.qm-device { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; background: var(--card); }
.qm-dev-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qm-dev-os { font-size: 13px; font-weight: 600; color: var(--ink); }
.qm-dev-sub { margin-top: 3px; }
.qm-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

@media (max-width: 560px) {
    .qm-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ============ محرّر تخصصات الفني ============ */
.cat-editor {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 3px;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}
.cat-tog {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border: 1px solid var(--line-strong);
    border-radius: 99px;
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    user-select: none;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.cat-tog:hover { border-color: var(--brand); }
.cat-tog.is-sel { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); font-weight: 600; }
.cat-tog.is-basic { background: var(--brand); border-color: transparent; color: #fff; }
.cat-star { font-size: 13px; line-height: 1; display: none; }
.cat-tog.is-sel:not(.is-basic):hover .cat-star { display: inline; color: var(--brand); }
.cat-tog.is-basic .cat-star { display: inline; color: #fff; }

/* ============ إظهار المزيد ============ */
.show-more-card .row-extra { display: none; }
.show-more-card.show-all .row-extra { display: table-row; }
.show-more-bar { padding: 10px 20px 14px; text-align: center; border-top: 1px solid var(--line); }

/* ============ قائمة قابلة للبحث (combobox) ============ */
.combo { position: relative; }
.combo-search { margin-bottom: 8px; }
.combo-selected { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.combo-selected b { color: var(--ink); font-weight: 600; }

.combo-list {
    list-style: none;
    margin: 0;
    padding: 4px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    max-height: 250px;
    overflow-y: auto;
    background: var(--card);
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

.combo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: background .1s ease;
}
.combo-item:hover,
.combo-item.is-active { background: var(--hover); }
.combo-item.is-selected { background: var(--brand-soft); }
.combo-item.is-selected .combo-item-main { color: var(--brand-strong); font-weight: 600; }

.combo-item-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}
.combo-item-main { font-weight: 500; color: var(--ink); }
.combo-item-sub { margin-right: auto; font-size: 11.5px; color: var(--muted); direction: rtl; }
.combo-item.is-selected .combo-item-sub { color: var(--brand-strong); }
.combo-item-action {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    text-decoration: none;
    flex: 0 0 auto;
}
.combo-item-action:hover {
    color: var(--brand);
    background: var(--brand-soft);
}
.combo-item-action svg { width: 15px; height: 15px; }
.combo-check { color: var(--brand); font-weight: 700; margin-right: 6px; }

.combo-empty,
.combo-more { padding: 12px 10px; text-align: center; color: var(--muted); font-size: 12px; }
.combo-more { border-top: 1px dashed var(--line); }

/* ============ التنبيهات ============ */

.toast-zone {
    position: fixed;
    bottom: 20px;
    right: 50%;
    transform: translateX(50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.toast {
    background: var(--ink-strong);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    animation: toast-in .25s ease;
}

.toast.err { background: var(--danger); }
.toast.ok { background: var(--success); }

html[data-theme="dark"] .toast {
    background: #20262D;
    color: #F4F6F8;
    border: 1px solid #343C45;
    box-shadow: 0 16px 36px rgba(0, 0, 0, .42);
}
html[data-theme="dark"] .toast.err { background: #3A1F23; border-color: #6B3038; color: #FFECEF; }
html[data-theme="dark"] .toast.ok { background: #173225; border-color: #2F6B4B; color: #EAFBF1; }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.alert {
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid;
}

.notice-dismissible { position: relative; padding-inline-end: 48px; }
.notice-close {
    position: absolute;
    inset-inline-end: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.notice-close:hover, .notice-close:active { background: transparent; color: inherit; opacity: .75; }
.notice-close:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.alert-danger { background: var(--danger-soft); border-color: #F1C9C9; color: var(--danger); }
.alert-success { background: var(--success-soft); border-color: #C4E5D3; color: var(--success); }

/* ============ مودال ============ */

.modal-back {
    position: fixed;
    inset: 0;
    background: rgba(35, 40, 47, .45);
    z-index: 100;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 16px;
    overflow-y: auto;
}

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

.modal {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    animation: toast-in .2s ease;
}
.modal.modal-wide { max-width: 760px; }

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

.modal-head h3 { font-size: 15px; }

.modal-close { background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; }

.modal-body { padding: 20px; }

.modal-foot {
    padding: 13px 20px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.assign-search-wrap { position: relative; margin-bottom: 8px; }
.assign-search-wrap .combo-search {
    margin-bottom: 0;
    padding-left: 82px;
}
.assign-suggest-btn {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    height: 28px;
    padding: 0 12px;
    border: 1px solid #111827;
    border-radius: 7px;
    background: #111827;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.assign-suggest-btn:hover { border-color: #000; background: #000; }
.assign-suggest-btn:disabled { opacity: .55; cursor: progress; }
.assign-tools-status {
    display: block;
    min-height: 16px;
    margin: -2px 0 8px;
    color: var(--muted);
    font-size: 11.5px;
}

.assign-suggestions { margin-bottom: 16px; }
.assign-suggestions-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}
.assign-suggestions-head b {
    display: block;
    color: var(--ink);
    font-size: 13px;
}
.assign-suggestions-head small,
.assign-suggestions-head span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.7;
}
.assign-suggestion-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.assign-suggestion {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    border-radius: 8px;
    padding: 10px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 9px;
    align-items: start;
    text-align: right;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.assign-suggestion:hover,
.assign-suggestion.is-selected {
    border-color: var(--brand);
    background: var(--brand-soft);
}
.assign-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--line);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 12px;
}
.assign-suggestion.is-selected .assign-rank {
    color: var(--brand);
    border-color: var(--brand);
}
.assign-main { min-width: 0; }
.assign-main b,
.assign-main small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.assign-main b { font-size: 12px; color: var(--ink); }
.assign-main small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.assign-metrics {
    text-align: center;
    color: var(--brand);
    min-width: 44px;
}
.assign-metrics b {
    display: block;
    font-size: 15px;
    line-height: 1;
}
.assign-metrics small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}
.assign-tags {
    grid-column: 2 / 4;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 2px;
}
.assign-tags span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}
.assign-tags span::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--brand);
    margin-inline-end: 5px;
    vertical-align: middle;
}
.assign-empty {
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    padding: 14px;
    text-align: center;
    font-size: 12px;
}

/* ============ صفحة الدخول (شاشة كاملة مقسّمة) ============ */

.auth-split {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--card);
}

/* --- جهة النموذج --- */
.auth-form-side {
    flex: 0 0 clamp(340px, 34%, 460px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
}

.auth-form { width: 100%; max-width: 380px; }

.auth-logo { display: block; width: 168px; max-width: 60%; height: auto; margin-bottom: 34px; }

.auth-title { font-size: 25px; font-weight: 700; letter-spacing: -.3px; margin-bottom: 6px; }
.auth-lead { color: var(--muted); font-size: 13.5px; margin-bottom: 26px; }

.auth-field { margin-bottom: 16px; }
.auth-field label { font-size: 12.5px; margin-bottom: 7px; }

.auth-input-wrap { position: relative; display: flex; align-items: center; }
.auth-input-wrap > svg {
    position: absolute;
    inset-inline-start: 12px;
    width: 17px; height: 17px;
    color: var(--faint);
    pointer-events: none;
}
.auth-input-wrap .input {
    padding-inline-start: 38px;
    padding-inline-end: 38px;
    height: 46px;
    font-size: 14px;
    border-radius: 10px;
}
.auth-input-wrap .input::placeholder { color: var(--faint); }

.auth-eye {
    position: absolute;
    inset-inline-end: 8px;
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border: none; background: none; cursor: pointer;
    color: var(--faint); border-radius: 7px;
}
.auth-eye:hover { color: var(--muted); background: var(--hover); }
.auth-eye svg { width: 17px; height: 17px; }
.auth-eye.on { color: var(--brand); }

.auth-submit {
    width: 100%;
    justify-content: center;
    height: 48px;
    font-size: 14.5px;
    border-radius: 10px;
    margin-top: 8px;
}

.auth-foot {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 11.5px;
    color: var(--faint);
}
.auth-foot svg { width: 14px; height: 14px; flex-shrink: 0; }

/* --- جهة العلامة --- */
.auth-visual {
    flex: 1 1 auto;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 56px;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(30,16,9,.20) 0%, rgba(28,15,9,.78) 100%),
        linear-gradient(150deg, rgba(224,90,38,.34), rgba(120,45,20,.30)),
        url("../brand/auth-buildings.jpg") center/cover no-repeat;
}

.auth-visual-inner { position: relative; width: 100%; max-width: 460px; }

.auth-visual-logo { width: 138px; height: auto; margin-bottom: 20px; filter: brightness(0) invert(1); }

.auth-visual-title {
    color: #fff;
    font-size: 30px;
    line-height: 1.4;
    font-weight: 700;
    letter-spacing: -.4px;
    text-shadow: 0 1px 24px rgba(0,0,0,.35);
}

@media (max-width: 900px) {
    .auth-visual { display: none; }
    .auth-form-side { flex: 1 1 100%; }
}

/* ============ عناصر مساعدة ============ */

.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fw-6 { font-weight: 600; }
.fs-12 { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: embed; }
.mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.order-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}
.order-detail-grid > .card {
    min-width: 0;
    height: 100%;
    margin-bottom: 0 !important;
    display: flex;
    flex-direction: column;
}
.order-detail-grid > .card > .card-pad { flex: 1; }
.order-detail-grid > .order-card-wide { grid-column: 1 / -1; }
.interview-shell {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}
.interview-shell > .card {
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.interview-shell > .card > .card-pad { flex: 1; }
.interview-summary { position: static; }
.interview-mini {
    display: grid;
    gap: 10px;
    margin-top: 16px;
    align-content: start;
}
.interview-mini > div {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
}
.interview-mini span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 3px;
}
.interview-mini b { color: var(--ink-strong); }
.interview-grid { row-gap: 16px; }
.interview-field-wide { grid-column: 1 / -1; }
.interview-notes-input {
    min-height: 112px;
    resize: vertical;
    line-height: 1.8;
}
.interview-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}
.city-combo { position: relative; }
.city-combo-list {
    position: absolute;
    z-index: 35;
    inset-inline: 0;
    top: calc(100% + 6px);
    display: none;
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--card);
    box-shadow: var(--shadow-lg);
}
.city-combo-list.open { display: block; }
.city-combo-item {
    display: block;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    text-align: right;
    padding: 10px 12px;
    cursor: pointer;
}
.city-combo-item:last-child { border-bottom: 0; }
.city-combo-item:hover,
.city-combo-item.is-selected {
    background: var(--hover);
    color: var(--brand-strong);
}
.city-combo-empty {
    padding: 12px;
    color: var(--muted);
    font-size: 12px;
}

.kv { display: grid; grid-template-columns: 140px 1fr; row-gap: 9px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink-strong); }

/* ============ استجابة الشاشات ============ */

@media (max-width: 1024px) {
    .sidebar { transform: translateX(100%); box-shadow: none; }
    .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
    .content-area { margin-right: 0; }
    .burger { display: inline-flex; }
    .page { padding: 20px 20px 40px; }

    .sidebar-back {
        position: fixed;
        inset: 0;
        background: rgba(35, 40, 47, .4);
        z-index: 45;
        display: none;
    }

    .sidebar-back.open { display: block; }

    .grid-2 { grid-template-columns: 1fr; }
    .order-detail-grid { grid-template-columns: 1fr; }
    .order-detail-grid > .order-card-wide { grid-column: auto; }
    .interview-shell { grid-template-columns: 1fr; }
    .interview-summary { position: static; }
    .interview-actions { grid-column: auto; }
}

@media (max-width: 720px) {
    .page { padding: 16px 14px 32px; }
    .topbar { padding: 0 14px; }
    .kv { grid-template-columns: 110px 1fr; }
    .page-head { align-items: flex-start; }
    .page-head h1 { font-size: 17px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0; }
    .stat { padding: 14px; gap: 0; }
    .stat:nth-child(2n)::after { display: none; }
    .stat .num { font-size: 21px; }
    .stat .lbl { font-size: 11px; }
    .card-pad { padding: 14px; }
    .card-head { padding: 12px 14px; }
    .dt-toolbar { padding: var(--table-toolbar-block-padding) 12px; gap: 8px; }
    .dt-search { flex: 1 1 100%; min-width: 0; }
    .dt-toolbar .select { flex: 1 1 auto; }
    .dt-toolbar .wallet-filter-input { flex: 1 1 140px; width: auto; }
    .provider-filter-combo,
    .provider-filter-combo.is-custom { flex: 1 1 100%; min-width: 0; }
    .provider-filter-combo select { flex: 1; min-width: 0; }
    /* الجداول تبقى قابلة للتمرير أفقياً */
    table.dt th { padding: var(--table-head-padding); white-space: nowrap; }
    table.dt td { padding: var(--table-cell-padding); white-space: nowrap; }
    .form-grid { grid-template-columns: 1fr; }
    .modal { max-width: 100%; }
    .user-meta { display: none; } /* نكتفي بالصورة الرمزية على الجوال */
    .topbar-title { font-size: 14px; }
}

@media (max-width: 480px) {
    .stat { flex-direction: row; justify-content: flex-start; }
}

@media (max-width: 340px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat::after { display: none; }
}

/* قائمة إجراءات الصف: تفتح نحو الداخل ولا تتجاوز حافة الشاشة */
@media (max-width: 720px) {
    .row-menu-list { left: auto; right: 0; }
}

/* طباعة */
@media print {
    .sidebar, .topbar, .dt-toolbar, .dt-footer, .page-actions { display: none !important; }
    .content-area { margin: 0; }
    .card { border: none; box-shadow: none; }
}

/* ===== مستندات وصور الفني ===== */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.doc-item {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px;
    background: var(--brand-softer);
}
.doc-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 9px;
}
.doc-image-link {
    display: block;
    width: 100%;
    height: 100%;
    background: #fff;
}
.doc-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.doc-preview .doc-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--brand-strong);
    font-size: 13px;
    padding: 22px;
}
.doc-preview .doc-file svg { width: 30px; height: 30px; }
.doc-empty { color: var(--muted); font-size: 12px; padding: 22px; }
.doc-upload {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--brand-strong);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    background: #fff;
}
.doc-upload:hover { border-color: var(--brand); background: var(--brand-soft); }
.doc-upload svg { width: 15px; height: 15px; }
.doc-upload input[type="file"] { display: none; }
.doc-fname { margin-top: 5px; word-break: break-all; }
.doc-remove {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 7px;
    color: var(--danger, #c0392b);
    cursor: pointer;
}
@media (max-width: 640px) { .doc-grid { grid-template-columns: 1fr; } }

/* ===== محرّر الصورة العام (img-drop) ===== */
.img-drop {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm);
    padding: 18px; text-align: center; cursor: pointer; color: var(--muted);
    font-size: 12.5px; font-weight: 600; background: var(--brand-softer);
    transition: border-color .12s ease, color .12s ease;
}
.img-drop:hover { border-color: var(--brand); color: var(--brand-strong); }
.img-drop svg { width: 22px; height: 22px; }
/* صورة مصغّرة داخل جداول القوائم */
.dt-thumb {
    width: 44px; height: 44px; object-fit: cover; border-radius: 7px;
    border: 1px solid var(--line); background: #fff; display: inline-block; vertical-align: middle;
}
.dt-thumb-empty {
    width: 44px; height: 44px; border-radius: 7px; border: 1px dashed var(--line-strong);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--muted); font-size: 10px; background: var(--brand-softer);
}

/* ===== محدّد نوع المستلمين (segmented) + متغيرات الإشعار ===== */
.seg {
    display: inline-flex;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--card);
}
.seg-btn {
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
.seg-btn + .seg-btn { border-inline-start: 1px solid var(--line); }
.seg-btn.active { background: var(--brand); color: #fff; }
.seg-btn:not(.active):hover { background: var(--brand-soft); color: var(--brand-strong); }

.var-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.var-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; font-size: 12px; font-weight: 600;
    color: var(--brand-strong); background: var(--brand-softer);
    border: 1px dashed var(--line-strong); border-radius: 20px; cursor: pointer;
    transition: border-color .12s ease, background .12s ease;
}
.var-chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.var-chip code { font-size: 11px; background: var(--hover); padding: 1px 5px; border-radius: 4px; direction: ltr; }

/* ===== خريطة الفنيين ===== */
.modal-map { width: 95vw; max-width: 1320px; padding: 0; }
.modal-map .map-head {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 18px; border-bottom: 1px solid var(--line);
}
.modal-map .map-head h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; white-space: nowrap; }
.modal-map .map-head h3 svg { width: 18px; height: 18px; color: var(--brand); }
.map-head-stats { color: var(--muted); font-size: 12.5px; flex: 1; }
.map-head-stats b { color: var(--ink-strong); font-weight: 700; }
.map-head-tools { display: flex; align-items: center; gap: 6px; }
.map-head-tools .modal-close { position: static; }
/* وضع ملء الشاشة */
.modal-map.is-fs { width: 100vw; height: 100vh; max-width: none; border-radius: 0; }
.modal-map.is-fs .map-shell { height: calc(100vh - 58px); }

/* الهيكل: لوحة جانبية + خريطة */
.map-shell { display: flex; height: 80vh; min-height: 460px; }
.map-side {
    width: 320px; flex-shrink: 0; border-inline-end: 1px solid var(--line);
    display: flex; flex-direction: column; background: var(--card); min-height: 0;
}
.map-filters { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.map-search { width: 100%; }
.map-search input { border: none; background: none; outline: none; width: 100%; font-family: inherit; font-size: 13px; color: var(--ink); }
.map-filter-row { display: flex; gap: 8px; }
.map-filter-row .select { flex: 1; min-width: 0; }
.map-online-toggle {
    display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
    color: var(--ink); white-space: nowrap; padding: 0 4px; cursor: pointer;
}
.map-list-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px; font-size: 12px; font-weight: 700; color: var(--muted);
    border-bottom: 1px solid var(--line);
}
.map-list { flex: 1; overflow-y: auto; min-height: 0; }
.map-li {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px;
    border-bottom: 1px solid var(--line); cursor: pointer; transition: background .1s ease;
}
.map-li:hover { background: var(--hover); }
.map-li-av {
    position: relative; width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; overflow: hidden;
    display: flex; align-items: center; justify-content: center; font-size: 15px; border: 2px solid var(--muted);
}
.map-li-av img { width: 100%; height: 100%; object-fit: cover; }
.map-li-av.tone-success { border-color: var(--success); }
.map-li-av.tone-danger  { border-color: var(--danger); }
.map-li-av.tone-warning { border-color: var(--warning); }
.map-li-av.tone-muted   { border-color: var(--muted); }
.map-li-av.online::after {
    content: ''; position: absolute; bottom: 0; inset-inline-end: 0;
    width: 9px; height: 9px; border-radius: 50%; background: var(--success); border: 1.5px solid #fff;
}
.map-li-body { flex: 1; min-width: 0; }
.map-li-name { font-weight: 600; font-size: 13px; color: var(--ink-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-li-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-li-rate { font-size: 12px; color: var(--warning); font-weight: 700; white-space: nowrap; }
.map-empty, .map-more { padding: 16px; text-align: center; color: var(--muted); font-size: 12.5px; }
.map-more { border-top: 1px dashed var(--line); }

/* منطقة الخريطة */
.map-main { flex: 1; position: relative; min-width: 0; }
#provMapCanvas { width: 100%; height: 100%; z-index: 0; }
.leaflet-container { font-family: inherit; background: #eef0f2; }
html[data-theme="dark"] .leaflet-container { background: #111417; }
.map-side-toggle { display: none; }

/* وسيلة الإيضاح */
.map-legend {
    position: absolute; bottom: 12px; inset-inline-start: 12px; z-index: 500;
    background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: var(--radius-sm);
    box-shadow: var(--shadow); padding: 7px 11px; display: flex; gap: 12px; flex-wrap: wrap;
    font-size: 11.5px; color: var(--ink); font-weight: 600;
}
html[data-theme="dark"] .map-legend {
    background: rgba(26, 30, 34, .94);
    border-color: var(--line-strong);
    color: var(--ink);
}
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.lg-success { background: var(--success); } .lg-warning { background: var(--warning); }
.lg-danger { background: var(--danger); } .lg-muted { background: var(--muted); }
.lg-online { background: #fff; border: 2px solid var(--success); }

/* التحميل */
.map-loading {
    position: absolute; inset: 0; z-index: 600; background: rgba(255,255,255,.85);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    color: var(--muted); font-size: 13px; font-weight: 600;
}
html[data-theme="dark"] .map-loading { background: rgba(17, 20, 23, .82); }
.map-loading .spinner {
    width: 34px; height: 34px; border: 3px solid var(--line-strong); border-top-color: var(--brand);
    border-radius: 50%; animation: mapspin .8s linear infinite;
}
@keyframes mapspin { to { transform: rotate(360deg); } }
.map-err { color: var(--danger); }

/* دبّوس الفني (صورة دائرية) */
.prov-pin {
    position: relative; width: 40px; height: 40px; border-radius: 50%;
    border: 2.5px solid var(--muted); background: #fff;
    box-shadow: 0 2px 7px rgba(0,0,0,.32);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;                 /* الصورة تبقى داخل الدائرة ولا تخرج من الإطار */
    transition: transform .12s ease;
}
.prov-pin:hover { transform: scale(1.12); z-index: 1000 !important; }
.prov-pin img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.prov-pin.tone-success { border-color: var(--success); }
.prov-pin.tone-danger  { border-color: var(--danger); }
.prov-pin.tone-warning { border-color: var(--warning); }
.prov-pin.tone-muted   { border-color: var(--muted); }
.prov-pin.online::after {
    content: ''; position: absolute; bottom: 1px; inset-inline-end: 1px;
    width: 10px; height: 10px; border-radius: 50%; background: var(--success); border: 2px solid #fff;
}
.prov-pin.noimg { background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; font-size: 16px; }
.prov-pin.noimg::before { content: attr(data-i); }

/* عنقود مخصّص بالهوية */
.prov-cluster {
    width: 100%; height: 100%; border-radius: 50%;
    background: radial-gradient(circle, var(--brand) 55%, rgba(224,90,38,.55) 100%);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; box-shadow: 0 2px 10px rgba(224,90,38,.5);
    border: 2.5px solid #fff;
}

/* نافذة معلومات الفني */
.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: var(--shadow-lg) !important;
    background: var(--card) !important;
    color: var(--ink) !important;
}
.leaflet-popup-tip { background: var(--card) !important; }
.leaflet-popup-content { margin: 0; width: auto !important; }
.prov-pop { padding: 12px 13px 11px; min-width: 210px; direction: rtl; text-align: right; }
.prov-pop .pp-top { display: flex; gap: 10px; align-items: center; }
.prov-pop .pp-img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); flex-shrink: 0; }
.prov-pop .pp-img.noimg { display: flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; font-size: 20px; }
.prov-pop .pp-id { min-width: 0; flex: 1; text-align: right; }
.prov-pop .pp-name { font-weight: 700; font-size: 14.5px; color: var(--ink-strong); }
.prov-pop .pp-cat { font-size: 12px; color: var(--brand-strong); margin-top: 1px; }
.prov-pop .pp-meta { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.prov-pop .pp-rows { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.prov-pop .pp-rows b { color: var(--ink-strong); font-weight: 600; }
.prov-pop .pp-phone { text-align: right; }
.prov-pop .pp-acts { margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.prov-pop .pp-act {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    width: 44px; min-height: 42px; padding: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--muted); border: 0;
}
.prov-pop .pp-act svg { width: 17px; height: 17px; stroke-width: 2; }
.prov-pop .pp-act span { font-size: 10.5px; line-height: 1; font-weight: 600; white-space: nowrap; }
.prov-pop .pp-act:hover { background: transparent; color: var(--brand); text-decoration: none; }
.prov-pop .pp-act.wa { background: transparent; color: var(--muted); }
.prov-pop .pp-act.wa:hover { color: #128c3e; }
html[data-theme="dark"] .prov-pop .pp-act.wa { background: transparent; color: var(--muted); }
html[data-theme="dark"] .prov-pop .pp-act.wa:hover { color: #63D98B; }

/* ليلاند: أزرار تحكم Leaflet بروح الهوية */
.leaflet-bar a, .leaflet-control-layers-toggle { border-radius: var(--radius-sm) !important; }
.leaflet-control-layers { border-radius: var(--radius-sm) !important; box-shadow: var(--shadow) !important; border: 1px solid var(--line) !important; }
.leaflet-touch .leaflet-bar a { color: var(--ink); }
html[data-theme="dark"] .leaflet-bar a,
html[data-theme="dark"] .leaflet-control-layers-toggle,
html[data-theme="dark"] .leaflet-control-layers,
html[data-theme="dark"] .leaflet-control-layers-expanded {
    background: var(--card) !important;
    color: var(--ink) !important;
    border-color: var(--line-strong) !important;
}
html[data-theme="dark"] .leaflet-bar a {
    border-bottom-color: var(--line-strong) !important;
}
html[data-theme="dark"] .leaflet-bar a:hover,
html[data-theme="dark"] .leaflet-control-layers-toggle:hover {
    background: var(--hover) !important;
}
html[data-theme="dark"] .leaflet-popup-close-button { color: var(--muted) !important; }

@media (max-width: 760px) {
    .modal-map { width: 100vw; height: 100vh; max-width: none; border-radius: 0; }
    .map-shell { height: calc(100vh - 58px); position: relative; }
    .map-side {
        position: absolute; inset-block: 0; inset-inline-start: 0; width: 86%; max-width: 330px;
        z-index: 700; transform: translateX(-104%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
    }
    [dir="rtl"] .map-side { transform: translateX(104%); }
    .map-side.open { transform: translateX(0); }
    .map-side-toggle {
        display: flex; align-items: center; justify-content: center;
        position: absolute; top: 12px; inset-inline-start: 12px; z-index: 650;
        width: 40px; height: 40px; border-radius: var(--radius-sm); background: #fff;
        border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer; color: var(--brand-strong);
    }
    .map-legend { font-size: 10.5px; gap: 8px; padding: 6px 8px; }
}

/* ============ إعدادات الموظف ============ */

.preference-page-head { align-items: center; }

.preference-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px 7px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 99px;
    box-shadow: var(--shadow);
}

.preference-user-avatar {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 700;
}

.preference-user-chip > span:last-child { display: flex; flex-direction: column; line-height: 1.35; }
.preference-user-chip b { color: var(--ink-strong); font-size: 12.5px; }
.preference-user-chip small { color: var(--muted); font-size: 10.5px; }

.preference-form {
    width: 100%;
    max-width: none;
    --preference-active: #252A30;
    --preference-selected: #F2F3F4;
}
html[data-theme="dark"] .preference-form {
    --preference-active: #E7EAEE;
    --preference-selected: #252A30;
}
.preference-section { margin-bottom: 16px; overflow: hidden; }

.preference-section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
}

.preference-section-head h2 { font-size: 15px; }
.preference-section-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.preference-section-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    background: transparent;
    color: #111111;
    flex: 0 0 auto;
}

.preference-section-icon svg { width: 18px; height: 18px; }
html[data-theme="dark"] .preference-section-icon { color: #F2F4F6; }
.preference-list { border-top: 1px solid var(--line); }

.preference-toggle-row,
.preference-field-row {
    min-height: 64px;
    margin: 0;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--line);
}

.preference-list > :last-child { border-bottom: 0; }
.preference-toggle-row { cursor: pointer; }
.preference-copy { display: flex; flex-direction: column; min-width: 0; }
.preference-copy b { color: var(--ink-strong); font-size: 13px; }
.preference-copy small { color: var(--muted); font-weight: 400; font-size: 11.5px; margin-top: 2px; }
.preference-select { width: 130px; flex: 0 0 130px; }

input.preference-switch {
    appearance: none;
    width: 44px;
    height: 24px;
    flex: 0 0 44px;
    margin: 0;
    border: 1px solid var(--line-strong);
    border-radius: 99px;
    background: var(--line-strong);
    position: relative;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease;
}

input.preference-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
    transition: transform .16s ease;
}

input.preference-switch:checked { background: var(--preference-active); border-color: var(--preference-active); }
input.preference-switch:checked::after { transform: translateX(-20px); }
input.preference-switch:focus-visible { outline: 2px solid var(--preference-active); outline-offset: 2px; }

.segmented-choice {
    display: inline-flex;
    padding: 3px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    flex: 0 0 auto;
}

.segmented-choice label { margin: 0; cursor: pointer; }
.segmented-choice input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-choice span { display: block; padding: 5px 15px; border-radius: 5px; color: var(--muted); font-size: 12px; }
.segmented-choice input:checked + span { background: var(--card); color: var(--ink-strong); box-shadow: inset 0 0 0 1px var(--line-strong); }
.segmented-choice input:focus-visible + span { outline: 2px solid var(--preference-active); }

.theme-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 2px 20px 20px;
}

.theme-choice {
    position: relative;
    display: grid;
    grid-template-columns: 118px 1fr auto;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.theme-choice:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.theme-choice > input { position: absolute; opacity: 0; pointer-events: none; }
.theme-choice:has(input:checked) { border-color: var(--ink-strong); box-shadow: none; }
.theme-choice:has(input:focus-visible) { outline: 2px solid var(--preference-active); outline-offset: 2px; }

.theme-preview {
    position: relative;
    width: 118px;
    height: 70px;
    display: block;
    overflow: hidden;
    border: 1px solid #D8DCE1;
    border-radius: 8px;
    background: #F4F3F0;
}

.theme-choice-dark .theme-preview { background: #111417; border-color: #343B43; }
.theme-choice-system .theme-preview { background: linear-gradient(90deg, #F4F3F0 0 50%, #111417 50% 100%); border-color: #7A8088; }
.theme-preview-side { position: absolute; inset: 0 auto 0 0; width: 27%; background: #FFFFFF; border-right: 1px solid #E4E1DC; }
.theme-preview-top { position: absolute; top: 0; right: 27%; left: 0; height: 14px; background: #FFFFFF; border-bottom: 1px solid #E4E1DC; }
.theme-preview-card { position: absolute; top: 23px; width: 25px; height: 16px; border-radius: 3px; background: #FFFFFF; border: 1px solid #E4E1DC; }
.theme-preview-card.one { right: 34px; }
.theme-preview-card.two { right: 65px; }
.theme-preview-line { position: absolute; right: 34px; bottom: 15px; width: 56px; height: 4px; border-radius: 4px; background: #E05A26; }
.theme-choice-dark .theme-preview-side,
.theme-choice-dark .theme-preview-top,
.theme-choice-dark .theme-preview-card { background: #1B1F23; border-color: #30363D; }
.theme-choice-system .theme-preview-side { background: #1B1F23; border-color: #30363D; }
.theme-choice-system .theme-preview-top { background: linear-gradient(90deg, #FFFFFF 0 31%, #1B1F23 31% 100%); border-color: #777; }
.theme-choice-system .theme-preview-card.one { background: #1B1F23; border-color: #30363D; }

.theme-choice-label { display: flex; flex-direction: column; min-width: 0; }
.theme-choice-label b { color: var(--ink-strong); font-size: 12.5px; }
.theme-choice-label small { color: var(--muted); font-weight: 400; font-size: 10.5px; line-height: 1.45; }
.theme-choice-check {
    width: 21px;
    height: 21px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    color: transparent;
    font-size: 12px;
}
.theme-choice:has(input:checked) .theme-choice-check { color: var(--card); background: var(--preference-active); border-color: var(--preference-active); }
.preference-list-after-theme { margin-top: 0; }

.preference-save-bar {
    position: sticky;
    bottom: 14px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 18px;
    padding: 12px 14px 12px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(18, 24, 31, .06);
}

.preference-save-bar > span { color: var(--muted); font-size: 12px; }

@media (max-width: 920px) {
    .theme-choice-grid { grid-template-columns: 1fr; }
    .theme-choice { grid-template-columns: 118px 1fr auto; }
}

@media (max-width: 560px) {
    .preference-user-chip { display: none; }
    .preference-section-head,
    .preference-toggle-row,
    .preference-field-row { padding-inline: 15px; }
    .preference-toggle-row,
    .preference-field-row { gap: 14px; }
    .preference-density-row { align-items: flex-start; flex-direction: column; }
    .theme-choice-grid { padding-inline: 15px; }
    .theme-choice { grid-template-columns: 98px 1fr auto; }
    .theme-preview { width: 98px; }
    .preference-save-bar { bottom: 8px; }
    .preference-save-bar > span { display: none; }
    .preference-save-bar .btn { width: 100%; }
}

/* ============ تخصيصات الموظف الموسعة ============ */

.preference-select-wide { width: 210px; flex-basis: 210px; }

.preference-options-row {
    padding: 14px 20px 17px;
    border-bottom: 1px solid var(--line);
}

.preference-list > .preference-options-row:last-child { border-bottom: 0; }

.preference-check-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 13px;
}

.preference-check-card { position: relative; margin: 0; cursor: pointer; }
.preference-check-card input { position: absolute; opacity: 0; pointer-events: none; }
.preference-check-card > span {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 12px;
    font-weight: 500;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.preference-check-card svg { width: 15px; height: 15px; color: var(--muted); }
.preference-check-card:hover > span { border-color: var(--line-strong); }
.preference-check-card input:checked + span {
    color: var(--ink-strong);
    background: var(--preference-selected);
    border-color: var(--line-strong);
}
.preference-check-card input:checked + span::after {
    content: '✓';
    margin-inline-start: auto;
    color: var(--ink-strong);
    font-weight: 800;
}
.preference-check-card input:focus-visible + span { outline: 2px solid var(--preference-active); outline-offset: 2px; }

.notification-check-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.notification-check-card > span { justify-content: center; text-align: center; }
.notification-dependent { transition: opacity .15s ease; }
.notification-dependent.is-muted { opacity: .5; }

.push-device-control { display: flex; align-items: center; gap: 10px; }
.push-device-control .btn { min-width: 72px; padding-block: 6px; }
.push-device-status { color: var(--muted); font-size: 11px; }

.push-permission-banner {
    position: fixed;
    bottom: 18px;
    left: 18px;
    z-index: 250;
    width: min(360px, calc(100vw - 36px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 14px;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    box-shadow: 0 8px 24px rgba(18, 24, 31, .12);
}
.push-permission-banner > div:first-child { min-width: 0; display: flex; flex-direction: column; }
.push-permission-banner b { color: var(--ink-strong); font-size: 12.5px; }
.push-permission-banner span { color: var(--muted); font-size: 11px; margin-top: 1px; }
.push-permission-banner > div:last-child { display: flex; align-items: center; gap: 5px; }
.push-permission-enable,
.push-permission-close {
    border: 0;
    font-family: inherit;
    cursor: pointer;
}
.push-permission-enable {
    padding: 7px 13px;
    color: var(--card);
    background: var(--ink-strong);
    border-radius: 7px;
    font-size: 11.5px;
    font-weight: 600;
}
.push-permission-close {
    width: 30px;
    height: 30px;
    color: var(--muted);
    background: transparent;
    border-radius: 50%;
    font-size: 19px;
    line-height: 1;
}
.push-permission-close:hover { background: var(--hover); }

.push-activation-back { align-items: center; padding-block: 20px; }
.push-activation-modal { max-width: 430px; }
.push-activation-modal .modal-body { text-align: center; padding: 26px 28px; }
.push-activation-modal .modal-body p { color: var(--ink); font-size: 13px; line-height: 1.8; margin: 12px auto 0; max-width: 340px; }
.push-activation-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    margin: 0 auto;
    border-radius: 50%;
    background: var(--hover);
    border: 1px solid var(--line);
    font-size: 24px;
}
.push-activation-confirm {
    color: var(--card);
    background: var(--ink-strong);
    border-color: var(--ink-strong);
}
.push-activation-confirm:hover { opacity: .9; }

.preference-reset-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 26px;
    padding: 17px 20px;
}
.preference-reset-section > div { display: flex; flex-direction: column; }
.preference-reset-section b { color: var(--ink-strong); font-size: 13px; }
.preference-reset-section small { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* جرس الإشعارات: مركز صغير للعمل اليومي داخل الهيدر */
.panel-notifications { position: relative; }
.notification-bell {
    position: relative;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--ink);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    cursor: pointer;
}
.notification-bell:hover { background: var(--hover); border-color: var(--line); }
.notification-bell:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 2px; }
.notification-bell > svg { width: 19px; height: 19px; }
.notification-badge {
    position: absolute;
    top: -2px;
    inset-inline-end: -3px;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    color: #fff;
    background: var(--danger);
    border: 2px solid var(--card);
    border-radius: 99px;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
}
.notification-badge[hidden] { display: none; }
.notification-dropdown { width: 360px; padding: 0; overflow: hidden; }
.notification-dropdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 15px;
    border-bottom: 1px solid var(--line);
}
.notification-dropdown-head b { color: var(--ink-strong); font-size: 13px; }
.notification-dropdown-head span { color: var(--muted); font-size: 10.5px; }
.notification-list { max-height: 360px; overflow-y: auto; }
.notification-dropdown .notification-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
}
.notification-item-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    margin-top: 5px;
    background: var(--faint);
    border-radius: 50%;
}
.notification-item.is-unread .notification-item-dot { background: var(--brand); }
.notification-type-order_paid.is-unread .notification-item-dot { background: var(--success); }
.notification-type-order_cancel.is-unread .notification-item-dot { background: var(--warning); }
.notification-type-provider_new.is-unread .notification-item-dot { background: #3467D6; }
.notification-dropdown .notification-item:not(.is-unread) { opacity: .82; }
.notification-item-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.notification-item-copy b { color: var(--ink-strong); font-size: 12px; }
.notification-item-copy small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notification-item-copy time { color: var(--faint); font-size: 9.5px; margin-top: 3px; direction: ltr; text-align: right; }
.notification-empty { padding: 30px 15px; color: var(--muted); text-align: center; font-size: 12px; }
.notification-dropdown .notification-settings-link {
    justify-content: center;
    padding: 10px 12px;
    color: var(--brand-strong);
    border-radius: 0;
    border-top: 1px solid var(--line);
    font-size: 11.5px;
}
.notification-settings-link svg { width: 14px; height: 14px; }

/* المساعد الذكي */
.panel-ai-toggle {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #7c3aed;
    font-family: inherit;
    cursor: pointer !important;
    white-space: nowrap;
    opacity: 1;
}
.panel-ai-toggle:hover {
    background: transparent;
    color: #7c3aed;
}
.panel-ai-toggle svg {
    width: 24px;
    height: 24px;
    color: currentColor;
    fill: currentColor;
    stroke: none;
    pointer-events: none;
}

.panel-ai-drawer {
    position: fixed;
    left: 22px;
    bottom: 22px;
    width: min(420px, calc(100vw - 28px));
    z-index: 90;
    display: none;
}
.panel-ai-drawer.open { display: block; }
.panel-ai-card {
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.panel-ai-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 15px;
    border-bottom: 1px solid var(--line);
}
.panel-ai-head b { display: block; color: var(--ink-strong); font-size: 13px; }
.panel-ai-head span { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.panel-ai-close {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.panel-ai-close:hover { background: var(--hover); color: var(--ink); }
.panel-ai-messages {
    height: min(390px, 52vh);
    overflow-y: auto;
    padding: 14px;
    background: var(--bg);
}
.panel-ai-msg {
    width: fit-content;
    max-width: 88%;
    padding: 9px 11px;
    margin-bottom: 9px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 12.5px;
    line-height: 1.75;
}
.panel-ai-msg.assistant {
    margin-inline-end: auto;
    background: var(--card);
    color: var(--ink);
}
.panel-ai-msg.user {
    margin-inline-start: auto;
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.panel-ai-msg.warn {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: color-mix(in srgb, var(--warning) 24%, transparent);
}
.panel-ai-msg.loading {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 52px;
}
.panel-ai-msg.loading span {
    width: 6px;
    height: 6px;
    background: var(--muted);
    border-radius: 50%;
    animation: aiTyping 1s infinite ease-in-out;
}
.panel-ai-msg.loading span:nth-child(2) { animation-delay: .12s; }
.panel-ai-msg.loading span:nth-child(3) { animation-delay: .24s; }
@keyframes aiTyping {
    0%, 80%, 100% { opacity: .35; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}
.panel-ai-suggestions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    padding: 10px 12px 0;
}
.panel-ai-suggestions button {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--muted);
    padding: 5px 9px;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
}
.panel-ai-suggestions button:hover { background: var(--hover); color: var(--ink); }
.panel-ai-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 12px;
}
.panel-ai-form textarea {
    min-height: 42px;
    max-height: 120px;
    resize: vertical;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 9px 10px;
    background: var(--card);
    color: var(--ink);
    font-family: inherit;
    font-size: 12.5px;
}
.panel-ai-form button {
    align-self: end;
    height: 42px;
    border: 1px solid var(--brand);
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    padding: 0 14px;
    cursor: pointer;
}
.panel-ai-form button:disabled { opacity: .6; cursor: wait; }

@media (max-width: 920px) {
    .preference-check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .notification-check-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .preference-field-row:has(.preference-select-wide) { align-items: flex-start; flex-direction: column; }
    .preference-select-wide { width: 100%; flex-basis: auto; }
    .preference-options-row { padding-inline: 15px; }
    .preference-check-grid,
    .notification-check-grid { grid-template-columns: 1fr 1fr; }
    .preference-reset-section { align-items: flex-start; flex-direction: column; }
    .preference-reset-section form,
    .preference-reset-section .btn { width: 100%; }
    .notification-dropdown {
        position: fixed;
        top: calc(var(--topbar-h) - 2px);
        right: 10px;
        left: 10px;
        width: auto;
    }
    .push-device-control { width: 100%; justify-content: space-between; }
    .push-permission-banner { right: 12px; bottom: 12px; left: 12px; width: auto; }
    .user-meta { display: none; }
    .panel-ai-toggle span { display: none; }
    .panel-ai-drawer { right: 14px; left: 14px; bottom: 14px; width: auto; }
}

/* إلغاء أي مؤشّر نقطي داخل شارات سبب الإلغاء نهائياً */
.reason-trigger::before,
.reason-trigger::after,
.reason-trigger .pill::before,
.reason-trigger .pill::after {
    content: none !important;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* شارات مسطّحة وهادئة: ألوان كاملة بدون واقعية/لمعان/ظلال ثقيلة */
.pill.tone-brand,
.pill.tone-success,
.pill.tone-danger,
.pill.tone-warning,
.pill.tone-info,
.pill.tone-indigo,
.pill.tone-orange,
.pill.tone-muted,
.pill[style*="--success"],
.pill[style*="--danger"],
.pill[style*="--warning"],
.pill[style*="--info"],
.pill[style*="--brand"],
.pill[style*="--muted"],
.cat-card-badge,
.cat-card-badge[style*="--success"],
.cat-card-badge[style*="--muted"],
.cat-card-badge[style*="--danger"],
.cat-card-badge[style*="--warning"] {
    color: #fff !important;
    border-color: transparent !important;
    text-shadow: none !important;
    box-shadow: 0 1px 2px rgba(18, 24, 31, .08) !important;
}

.pill.tone-brand,
.pill.tone-orange,
.pill[style*="--brand"] { background: #E85B2A !important; }
.pill.tone-success,
.pill[style*="--success"],
.cat-card-badge[style*="--success"],
.cat-card-badge:not([style]) { background: #1F9F67 !important; }
.pill.tone-danger,
.pill[style*="--danger"],
.cat-card-badge[style*="--danger"] { background: #D84E4E !important; }
.pill.tone-warning,
.pill[style*="--warning"],
.cat-card-badge[style*="--warning"] { background: #B97816 !important; }
.pill.tone-info,
.pill[style*="--info"] { background: #2F6FD6 !important; }
.pill.tone-indigo { background: #6664D9 !important; }
.pill.tone-muted,
.pill[style*="--muted"],
.cat-card-badge,
.cat-card-badge[style*="--muted"] { background: #59616B !important; }

.pill::before,
.pill::after,
.cat-card-badge::before,
.cat-card-badge::after,
.reason-trigger::before,
.reason-trigger::after,
.reason-trigger .pill::before,
.reason-trigger .pill::after {
    content: none !important;
    display: none !important;
    opacity: 0 !important;
    box-shadow: none !important;
}

/* حالات موحدة بدون خلفيات: خط جانبي فقط حسب اللون */
.pill,
.cat-card-badge,
.pill.tone-brand,
.pill.tone-success,
.pill.tone-danger,
.pill.tone-warning,
.pill.tone-info,
.pill.tone-indigo,
.pill.tone-orange,
.pill.tone-muted,
.pill[style],
.pill[style*="--success"],
.pill[style*="--danger"],
.pill[style*="--warning"],
.pill[style*="--info"],
.pill[style*="--brand"],
.pill[style*="--muted"],
.cat-card-badge[style],
.cat-card-badge[style*="--success"],
.cat-card-badge[style*="--muted"],
.cat-card-badge[style*="--danger"],
.cat-card-badge[style*="--warning"] {
    min-height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    padding: 1px 8px 1px 0;
    border: 0 !important;
    border-inline-start: 2px solid var(--muted) !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--muted) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    line-height: 1.45;
    white-space: nowrap;
    vertical-align: middle;
}

.pill.tone-brand,
.pill.tone-orange,
.pill[style*="--brand"] {
    border-inline-start-color: var(--brand) !important;
    color: var(--brand) !important;
}

.pill.tone-success,
.pill[style*="--success"],
.cat-card-badge[style*="--success"],
.cat-card-badge:not([style]) {
    border-inline-start-color: var(--success) !important;
    color: var(--success) !important;
}

.pill.tone-danger,
.pill[style*="--danger"],
.cat-card-badge[style*="--danger"] {
    border-inline-start-color: var(--danger) !important;
    color: var(--danger) !important;
}

.pill.tone-warning,
.pill[style*="--warning"],
.cat-card-badge[style*="--warning"] {
    border-inline-start-color: var(--warning) !important;
    color: var(--warning) !important;
}

.pill.tone-info,
.pill[style*="--info"] {
    border-inline-start-color: var(--info) !important;
    color: var(--info) !important;
}

.pill.tone-indigo {
    border-inline-start-color: var(--indigo) !important;
    color: var(--indigo) !important;
}

.pill.tone-muted,
.pill[style*="--muted"],
.cat-card-badge,
.cat-card-badge[style*="--muted"] {
    border-inline-start-color: var(--muted) !important;
    color: var(--muted) !important;
}

/* Team chat */
.is-chat-page {
    overflow: hidden;
}

.is-chat-page .content-area {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.is-chat-page .page {
    height: calc(100vh - var(--topbar-h));
    height: calc(100dvh - var(--topbar-h));
    min-height: 0;
    overflow: hidden;
    display: flex;
    padding-bottom: 24px;
}

.chat-shell {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 18px;
    min-height: calc(100vh - var(--topbar-h) - 56px);
}

.is-chat-page .chat-shell {
    width: 100%;
    height: 100%;
    min-height: 0;
}

.chat-sidebar,
.chat-thread {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.chat-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chat-sidebar-head {
    padding: 20px 20px 14px;
    border-bottom: 1px solid var(--line);
}

.chat-sidebar-head h1 {
    margin: 0;
    font-size: 19px;
    color: var(--ink-strong);
}

.chat-sidebar-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12.5px;
}

.chat-search-box {
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--line);
}

.chat-directory,
.chat-conversation-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    overflow-y: auto;
}

.chat-list-title {
    padding: 8px 8px 4px;
    color: var(--faint);
    font-size: 11px;
    font-weight: 700;
}

.chat-directory-item,
.chat-conversation-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 14px;
    padding: 12px;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
    text-align: right;
}

.chat-directory-item:hover,
.chat-conversation-item:hover,
.chat-conversation-item.is-active {
    background: var(--hover);
    border-color: var(--line);
}

.chat-directory-copy,
.chat-conversation-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-directory-copy b,
.chat-conversation-copy b {
    color: var(--ink-strong);
    font-size: 13px;
}

.chat-directory-copy small,
.chat-conversation-copy small {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-conversation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.chat-conversation-row time {
    color: var(--faint);
    font-size: 10px;
    flex: 0 0 auto;
}

.chat-pill {
    min-width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

.chat-main {
    min-width: 0;
    min-height: 0;
    display: flex;
}

.chat-main [hidden],
.chat-sidebar [hidden] {
    display: none !important;
}

.chat-empty,
.chat-thread {
    width: 100%;
    height: 100%;
}

.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 24px;
    text-align: center;
    margin: auto;
}

.chat-empty-icon {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    background: transparent;
}

.chat-empty-icon svg {
    width: 42px;
    height: 42px;
}

.chat-empty h2 {
    margin: 0;
    font-size: 20px;
    color: var(--ink-strong);
}

.chat-empty p {
    max-width: 420px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
}

.chat-thread {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chat-thread-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.chat-thread-person {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-thread-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-strong);
}

.chat-thread-state {
    margin-top: 4px;
    font-size: 11px;
    color: var(--muted);
}

.chat-avatar {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 14px;
    font-weight: 700;
    position: relative;
    flex: 0 0 40px;
}

.chat-avatar-presence {
    overflow: visible;
}

.chat-presence-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #CBD5E1;
    border: 2px solid var(--card);
    bottom: -1px;
    inset-inline-end: -1px;
}

.chat-presence-dot.is-online {
    background: #22C55E;
}

.chat-message-pane {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.01), rgba(15, 23, 42, 0)), var(--page);
}

.chat-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 78%;
}

.chat-message.is-own {
    align-self: flex-start;
    flex-direction: row-reverse;
}

.chat-bubble {
    min-width: 0;
    background: #F7F7F8;
    border: 1px solid #E8E8EB;
    border-radius: 18px;
    padding: 12px 14px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

html[data-theme="dark"] .chat-bubble {
    background: #1E232B;
    border-color: #303844;
}

.chat-message.is-own .chat-bubble {
    background: #EAF4FF;
    border-color: #CFE4FF;
}

html[data-theme="dark"] .chat-message.is-own .chat-bubble {
    background: rgba(39, 109, 243, 0.16);
    border-color: rgba(86, 144, 255, 0.28);
}

.chat-message-text {
    color: var(--ink);
    font-size: 13px;
    line-height: 1.9;
    word-break: break-word;
}

.chat-meta {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: var(--faint);
}

.chat-message-status {
    color: var(--brand-strong);
    font-weight: 600;
}

.chat-message-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity .15s ease;
}

.chat-message:hover .chat-message-actions {
    opacity: 1;
}

.chat-mini-btn,
.chat-tool-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    vertical-align: middle;
}

.chat-mini-btn:hover,
.chat-tool-btn:hover {
    background: var(--hover);
}

.chat-mini-btn svg,
.chat-tool-btn svg,
.chat-send-btn svg {
    width: 16px;
    height: 16px;
}

.chat-quoted {
    width: 100%;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: rgba(15, 23, 42, 0.05);
    border: 0;
    border-radius: 12px;
    color: var(--muted);
    font-size: 11px;
    text-align: right;
    cursor: pointer;
}

.chat-image {
    display: block;
    margin-top: 8px;
}

.chat-image img {
    width: min(280px, 100%);
    max-height: 240px;
    display: block;
    object-fit: cover;
    border-radius: 14px;
}

.chat-audio {
    margin-top: 10px;
}

.chat-audio audio {
    width: min(280px, 100%);
}

.chat-file {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: inherit;
}

.chat-file b {
    font-size: 12px;
    color: var(--ink-strong);
}

.chat-file small {
    font-size: 10.5px;
    color: var(--muted);
}

.chat-reply-bar,
.chat-upload-queue,
.chat-composer,
.chat-recorder {
    border-top: 1px solid var(--line);
}

.chat-reply-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: var(--page);
}

.chat-reply-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-reply-copy b {
    font-size: 11px;
    color: var(--ink-strong);
}

.chat-reply-copy span {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-upload-queue {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
    background: var(--page);
}

.chat-pending-item {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
}

.chat-pending-preview {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--page);
}

.chat-pending-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-pending-preview audio {
    width: 100%;
}

.chat-pending-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-pending-copy b {
    font-size: 12px;
    color: var(--ink-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-pending-copy small {
    color: var(--muted);
    font-size: 10.5px;
}

.chat-file-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 10px;
    font-weight: 700;
}

.chat-progress {
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: var(--page);
    overflow: hidden;
}

.chat-progress span {
    display: block;
    height: 100%;
    background: var(--brand);
}

.chat-composer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 14px;
    background: var(--card);
}

.chat-composer-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 46px;
}

.chat-composer-tools .chat-tool-btn {
    align-self: center;
    margin: 0;
}

.chat-composer-tools label.chat-tool-btn {
    transform: translateY(1px);
}

.chat-input {
    min-height: 46px;
    max-height: 140px;
    resize: vertical;
}

.chat-input:disabled,
.chat-send-btn:disabled,
.chat-tool-btn.is-disabled {
    opacity: .55;
    cursor: not-allowed;
}

.chat-send-btn {
    min-width: 94px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1;
}

.chat-send-btn svg {
    transform: translateY(1px);
}

.chat-recorder {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    background: var(--page);
}

.chat-recorder-state {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-recording-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.12);
}

.chat-recorder-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-list-empty {
    padding: 24px 14px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

@media (max-width: 980px) {
    .chat-shell {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(180px, 34%) minmax(0, 1fr);
    }

    .chat-sidebar {
        min-height: 0;
    }

    .chat-thread,
    .chat-empty {
        min-height: 0;
    }
}

@media (max-width: 640px) {
    .chat-message {
        max-width: 100%;
    }

    .chat-composer {
        grid-template-columns: 1fr;
    }

    .chat-send-btn {
        width: 100%;
        justify-content: center;
    }
}
.payment-link-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1px;margin-bottom:18px;overflow:hidden;border:1px solid var(--line);border-radius:12px;background:var(--line)}
.payment-link-summary>div{display:flex;justify-content:space-between;gap:12px;padding:12px;background:var(--card)}
.payment-link-summary span{color:var(--muted);font-size:12px}
.payment-link-copy-row{display:flex;gap:8px;align-items:stretch}
.payment-link-copy-row .input{direction:ltr;text-align:left;min-width:0}
.payment-link-copy-row .btn{white-space:nowrap}
.payment-link-security{margin:8px 0 0;line-height:1.7}
.payment-conflict-copy{margin:0 0 14px;color:var(--ink);line-height:1.7}
.payment-conflict-session{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1px;overflow:hidden;border:1px solid var(--line);border-radius:10px;background:var(--line)}
.payment-conflict-session>div{display:grid;gap:5px;padding:13px;background:var(--card)}
.payment-conflict-session span{color:var(--muted);font-size:12px}
.payment-conflict-hint{margin:13px 0 0;color:var(--muted);font-size:12px;line-height:1.75}
.payment-conflict-actions{justify-content:space-between}
@media(max-width:560px){.payment-link-summary,.payment-conflict-session{grid-template-columns:1fr}.payment-link-copy-row,.payment-conflict-actions{flex-direction:column}.payment-conflict-actions .btn{width:100%;justify-content:center}}
