/* الباخرة — إيقاع تصميم موحّد: كل قسم يكمل التالي */
:root {
    --ink: #0b1f2a;
    --ink-2: #143445;
    --harbor: #1aa6a0;
    --harbor-deep: #12807b;
    --brass: #c8962e;
    --sand: #e8eef1;
    --fog: #eef3f4;
    --paper: #ffffff;
    --text-main: #15262f;
    --text-muted: #5b6f7a;
    --border: rgba(11, 31, 42, 0.1);
    --success: #1f9d6a;
    --warning: #c4841d;
    --danger: #c43c3c;
    --sidebar-bg: linear-gradient(180deg, #0b1f2a 0%, #123847 58%, #0f4f4c 100%);
    --font-ui: 'Cairo', sans-serif;
    --font-brand: 'Cairo', sans-serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);

    /* شبكة إيقاع واحدة لكل الصفحة */
    --space-1: 8px;
    --space-2: 12px;
    --space-3: 16px;
    --space-4: 24px;
    --space-5: 32px;
    --space-6: 48px;
    --rail-w: 272px;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 10px 28px rgba(11, 31, 42, 0.08);
    --line: 1px solid var(--border);
}

* { box-sizing: border-box; }
html { font-size: 18px; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: var(--font-ui);
    color: var(--text-main);
    line-height: 1.65;
    font-weight: 500;
    background: var(--fog);
    -webkit-font-smoothing: antialiased;
}
body.app-ready { overflow: hidden; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

@keyframes riseIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}
@keyframes ticketLeave {
    from { opacity: 1; transform: translateX(0); max-height: 220px; margin-bottom: 14px; }
    to { opacity: 0; transform: translateX(-72px); max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; border-width: 0; }
}
@keyframes accentSweep {
    from { transform: scaleX(0.35); opacity: 0.4; }
    to { transform: scaleX(1); opacity: 1; }
}
@keyframes pulseLive {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(0.86); }
}
@keyframes spinSoft {
    to { transform: rotate(360deg); }
}
@keyframes waStageIn {
    from { opacity: 0; transform: translateY(18px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

/* ========== 1) دخول: قسم واحد متسلسل ========== */
.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--space-5);
    position: relative;
    overflow: hidden;
}
.login-stage {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(26, 166, 160, 0.28), transparent 60%),
        linear-gradient(160deg, #0b1f2a 0%, #123847 50%, #0f4f4c 100%);
}
.login-stage::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 35%;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.25));
}
.login-compose {
    position: relative;
    z-index: 2;
    width: min(440px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    text-align: center;
    color: #fff;
    animation: riseIn 0.55s var(--ease) both;
}
.login-mark {
    width: clamp(200px, 42vw, 260px);
    height: auto;
    display: block;
    background: #fff;
    border-radius: 50%;
    padding: 18px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.28);
}
.login-tagline {
    margin: 0;
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
.login-line {
    margin: 0 0 var(--space-2);
    font-size: 1.15rem;
    font-weight: 500;
    color: rgba(255,255,255,0.88);
    max-width: 30ch;
}
.login-form {
    width: 100%;
    display: grid;
    gap: var(--space-3);
    text-align: start;
    padding: var(--space-4);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    backdrop-filter: blur(12px);
}
.login-form .field {
    display: grid;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}
.login-form input {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(11,31,42,0.45);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 1.15rem;
    font-family: inherit;
    outline: none;
}
.login-form input:focus {
    border-color: var(--harbor);
    box-shadow: 0 0 0 3px rgba(26,166,160,0.28);
}
.btn-login {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 15px;
    font: 700 1.15rem var(--font-ui);
    color: var(--ink);
    background: linear-gradient(90deg, #f0c14b, #1aa6a0);
    cursor: pointer;
}
.btn-login.is-loading { opacity: 0.7; pointer-events: none; }

/* ========== 2) الهيكل: شريط + مساحة عمل متصلة ========== */
.app-shell {
    height: 100vh;
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
}

.nav-rail {
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    color: #fff;
    padding: var(--space-3);
    border-inline-end: 1px solid rgba(255,255,255,0.08);
    overflow: auto;
}
.nav-rail-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-2) var(--space-4);
    margin-bottom: var(--space-2);
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.nav-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 8px;
    flex-shrink: 0;
}
.brand-name {
    display: block;
    font-family: var(--font-brand);
    font-size: 1.45rem;
    line-height: 1.1;
}
.brand-tag {
    display: block;
    margin-top: 4px;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.68);
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--space-2) 0 var(--space-3);
}
.nav-group + .nav-group {
    border-top: 1px solid rgba(255,255,255,0.1);
}
.nav-group-label {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.5);
    padding: 6px 10px 10px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 0;
    background: transparent;
    color: rgba(255,255,255,0.92);
    padding: 13px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: start;
    font: 650 1.05rem/1.3 var(--font-ui);
    transition: background 0.2s var(--ease);
}
.menu-item .material-symbols-rounded { font-size: 26px; }
.menu-text { flex: 1; }
.menu-item:hover { background: rgba(255,255,255,0.08); }
.menu-item.active {
    background: rgba(26,166,160,0.24);
    box-shadow: inset 3px 0 0 var(--harbor);
}
.menu-count {
    min-width: 28px;
    height: 28px;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    background: var(--brass);
    color: #1a1405;
    padding: 0 8px;
}
.menu-count.has-items { display: inline-flex; }

.nav-rail-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: var(--space-3);
    border-top: 1px solid rgba(255,255,255,0.12);
}
.user-chip { font-size: 1rem; color: rgba(255,255,255,0.75); padding: 4px; }
.btn-sidebar {
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.06);
    color: #fff;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    font: 650 1rem var(--font-ui);
}
.btn-sidebar.danger {
    border-color: rgba(196,60,60,0.45);
    background: rgba(196,60,60,0.22);
}

/* ========== 3) مساحة العمل: عنوان → محتوى بنفس الإيقاع ========== */
.workspace {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    background:
        linear-gradient(180deg, #f7fbfb 0%, var(--fog) 120px);
}
.workspace-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5) var(--space-3);
    border-bottom: var(--line);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(247,251,251,0.9) 100%);
}
.page-kicker {
    display: block;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--harbor-deep);
    margin-bottom: 4px;
}
.page-title {
    margin: 0;
    font-family: var(--font-brand);
    font-size: clamp(1.7rem, 3vw, 2.2rem);
    color: var(--ink);
    line-height: 1.15;
}
.page-desc {
    margin: 8px 0 0;
    font-size: 1.05rem;
    color: var(--text-muted);
}
.workspace-bar-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    min-width: 0;
}
.status-strip {
    display: flex;
    align-items: stretch;
    gap: 0;
    border: 1px solid rgba(11, 31, 42, 0.12);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 8px 22px rgba(11, 31, 42, 0.05);
}
.status-count {
    display: grid;
    align-content: center;
    gap: 2px;
    padding: 10px 16px;
    background: linear-gradient(160deg, #0b1f2a 0%, #164556 100%);
    color: #fff;
    min-width: 88px;
    text-align: center;
}
.status-count-value {
    font-family: var(--font-brand);
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1;
}
.status-count-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0.78;
}
.status-wa {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    padding: 10px 16px;
    cursor: pointer;
    font: 700 0.98rem var(--font-ui);
    color: var(--harbor-deep);
    white-space: nowrap;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.status-wa:hover { background: rgba(26, 166, 160, 0.08); }
.status-wa.offline { color: var(--text-muted); }
.status-wa.offline .wa-live-dot { background: #9aa8b0; box-shadow: none; animation: none; }
.status-wa.online .wa-live-dot {
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(31, 157, 106, 0.18);
    animation: pulseLive 1.8s var(--ease) infinite;
}
.wa-live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--harbor);
    flex-shrink: 0;
}
.status-host {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.85;
}
.status-host:hover { color: var(--harbor-deep); }

.board-alert {
    margin: var(--space-3) var(--space-5) 0;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: rgba(200,150,46,0.14);
    border: 1px solid rgba(200,150,46,0.35);
    color: #6b4a0a;
    font-weight: 700;
    font-size: 1.05rem;
}

.workspace-pages { min-height: 0; overflow: hidden; }
.page-panel { display: none; height: 100%; }
.page-panel.active {
    display: block;
    animation: riseIn 0.28s var(--ease);
}
.page-canvas {
    height: 100%;
    overflow: auto;
    padding: var(--space-4) var(--space-5) var(--space-6);
}
.page-canvas-narrow { max-width: 900px; }

/* ========== 4) بطاقات الوصل — عرضية ========== */
.order-board { min-height: 36vh; }
.ticket-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.order-card.ticket {
    --accent: var(--harbor);
    display: flex;
    flex-direction: column;
    background:
        linear-gradient(105deg, #ffffff 0%, #f7fbfb 72%, #f3f8f9 100%);
    border: 3px solid var(--accent);
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(11, 31, 42, 0.055);
    overflow: hidden;
    position: relative;
    isolation: isolate;
    min-height: 118px;
    transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.28s var(--ease);
}
.order-card.ticket.is-leaving {
    animation: ticketLeave 0.38s var(--ease) forwards;
    pointer-events: none;
    overflow: hidden;
}
.order-card.ticket:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px rgba(11, 31, 42, 0.09);
    border-color: var(--accent);
}
.order-card.ticket::before {
    display: none;
}
.order-card.ticket.row-warn { --accent: var(--warning); }
.order-card.ticket.row-danger { --accent: var(--danger); }
.order-card.ticket.row-green { --accent: var(--success); }
.order-card.ticket.row-blue { --accent: #2f7db8; }
.order-card.ticket.row-safe { --accent: var(--harbor); }

.ticket-group {
    padding: 10px 16px;
    background: var(--ink);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: 0.01em;
    border-bottom: 3px solid var(--accent);
}
.ticket-row {
    display: grid;
    grid-template-columns: minmax(150px, 200px) minmax(0, 1fr) auto;
    align-items: stretch;
    flex: 1;
    min-width: 0;
}

.ticket-rail {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    padding: 16px 14px 16px 18px;
    background: rgba(11, 31, 42, 0.03);
    border-inline-end: 1px solid rgba(11, 31, 42, 0.06);
}
.ticket-id { display: flex; align-items: center; gap: 10px; }
.seq-badge.seq-sm {
    min-width: 30px !important;
    height: 30px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(11, 31, 42, 0.07) !important;
    color: var(--ink) !important;
    border-radius: 9px !important;
    font-size: 0.88rem !important;
    font-weight: 800 !important;
    flex-shrink: 0;
}
.order-num-sm {
    font-family: var(--font-brand);
    font-size: clamp(1.35rem, 2vw, 1.65rem);
    color: var(--ink);
    text-decoration: none;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    transition: color 0.2s var(--ease);
}
.order-num-sm:hover { color: var(--harbor-deep); }
.ticket-age {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.8);
    padding: 4px 9px;
    border-radius: 8px;
}
.ticket-age.is-processing {
    color: #8a5a08;
    background: rgba(200, 150, 46, 0.16);
}
.ticket-source {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--harbor-deep);
    max-width: 160px;
    line-height: 1.35;
}

.ticket-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 14px 16px;
    min-width: 0;
}
.ticket-note {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    border-inline-start: 3px solid var(--accent);
    padding-inline-start: 12px;
    font-size: 0.98rem;
    font-weight: 500;
    line-height: 1.55;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ticket-note.muted { color: var(--text-muted); border-color: rgba(11,31,42,0.15); }
.ticket-actions .btn-moves {
    width: 100%;
    justify-content: center;
    min-height: 38px;
    margin-bottom: 2px;
}
.btn-moves {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    border: 1px solid rgba(11, 31, 42, 0.12);
    background: #fff;
    color: var(--ink);
    border-radius: 10px;
    padding: 7px 12px;
    font: 700 0.88rem var(--font-ui);
    cursor: pointer;
    transition: background 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.btn-moves:hover {
    background: rgba(26, 166, 160, 0.08);
    border-color: rgba(26, 166, 160, 0.35);
    transform: translateY(-1px);
}
.btn-moves-count {
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-size: 0.75rem;
    padding: 0 6px;
}

.moves-modal[hidden] { display: none !important; }
.moves-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 20px;
}
.moves-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 24, 32, 0.62);
}
.moves-modal-panel {
    position: relative;
    z-index: 1;
    width: min(920px, 100%);
    max-height: min(84vh, 900px);
    overflow: auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.28);
    animation: ticketIn 0.28s var(--ease) both;
}
.moves-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 22px 12px;
    border-bottom: 1px solid rgba(11, 31, 42, 0.08);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}
.moves-modal-kicker {
    margin: 0 0 4px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--harbor-deep);
}
.moves-modal-head h3 {
    margin: 0;
    font-family: var(--font-brand);
    font-size: 1.35rem;
    color: var(--ink);
}
.moves-modal-close {
    border: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(11, 31, 42, 0.06);
    color: var(--ink);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.moves-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 14px 22px;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
}
.moves-modal-meta b { color: var(--ink); font-weight: 800; margin-inline-end: 4px; }
.moves-modal-body { padding: 0 22px 22px; }
.moves-empty {
    padding: 36px 16px;
    text-align: center;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 1.05rem;
}
.moves-table-wrap {
    overflow: auto;
    border: 1px solid rgba(11, 31, 42, 0.08);
    border-radius: 14px;
}
.moves-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.moves-table th {
    text-align: start;
    background: rgba(11, 31, 42, 0.04);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
    padding: 12px 14px;
    white-space: nowrap;
}
.moves-table td {
    padding: 12px 14px;
    border-top: 1px solid rgba(11, 31, 42, 0.06);
    vertical-align: top;
}
.moves-table tbody tr:hover td { background: rgba(26, 166, 160, 0.05); }
.moves-table .col-num { width: 48px; color: var(--text-muted); font-weight: 700; }
.moves-table .col-action { font-weight: 800; color: var(--ink); min-width: 120px; }
.moves-table .col-prev { color: var(--text-muted); min-width: 110px; }
.moves-table .col-by { min-width: 100px; font-weight: 700; }
.moves-table .col-date { white-space: nowrap; color: var(--text-muted); font-weight: 600; }
body.modal-open { overflow: hidden; }

.ticket-repeat,
.ticket-flag {
    margin: 0;
    padding: 8px 12px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 0.9rem;
    width: fit-content;
    max-width: 100%;
    line-height: 1.5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.ticket-flag-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    color: #fff;
}
.ticket-flag-body {
    min-width: 0;
}
.ticket-flag-forward {
    border: 1px solid rgba(30, 90, 120, 0.35);
    background: rgba(30, 90, 120, 0.08);
    color: var(--ink);
}
.ticket-flag-forward .ticket-flag-badge {
    background: var(--harbor, #1e5a78);
}
.ticket-flag-repeat,
.ticket-repeat {
    border: 1px dashed rgba(196, 60, 60, 0.45);
    background: rgba(196, 60, 60, 0.06);
    color: var(--danger);
}
.ticket-flag-repeat .ticket-flag-badge {
    background: var(--danger, #c43c3c);
}
.order-card.ticket.row-forward {
    box-shadow: inset 4px 0 0 var(--harbor, #1e5a78);
}
.order-card.ticket.row-repeat {
    box-shadow: inset 4px 0 0 var(--danger, #c43c3c);
}
.ticket-forward-to {
    color: var(--ink);
    font-weight: 800;
}
.ticket-forward-by {
    color: var(--text-muted);
    font-weight: 700;
}
.ticket-auto-dismiss {
    display: inline-block;
    margin-inline-start: 2px;
    color: #8a5a08;
    background: rgba(200, 150, 46, 0.16);
    border-radius: 7px;
    padding: 2px 8px;
    font-size: 0.78rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.ticket-auto-dismiss b {
    font-size: 0.95rem;
    color: var(--ink);
}
.ticket-auto-dismiss.is-urgent {
    color: #7a1f1f;
    background: rgba(196, 60, 60, 0.18);
}
.ticket-auto-dismiss.is-urgent b {
    color: var(--danger, #c43c3c);
}
.ticket-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.ticket-fact {
    display: grid;
    gap: 1px;
    padding: 7px 11px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(11, 31, 42, 0.06);
    min-width: 0;
    max-width: 220px;
}
.ticket-fact-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.ticket-fact-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ticket-fact-value a {
    color: var(--harbor-deep);
    text-decoration: none;
}
.ticket-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    padding: 5px 10px;
    border-radius: 9px;
    background: rgba(26, 166, 160, 0.12);
    color: var(--ink);
    font-size: 0.8rem;
    font-weight: 800;
}
.order-card.ticket.row-warn .ticket-status { background: rgba(196, 132, 29, 0.14); }
.order-card.ticket.row-danger .ticket-status { background: rgba(196, 60, 60, 0.12); }
.order-card.ticket.row-green .ticket-status { background: rgba(31, 157, 106, 0.14); }
.order-card.ticket.row-blue .ticket-status { background: rgba(47, 125, 184, 0.14); }
.ticket-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
}

.ticket-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 12px 12px;
    margin: 0;
    background: rgba(11, 31, 42, 0.03);
    border-inline-start: 1px solid rgba(11, 31, 42, 0.06);
    min-width: 148px;
}
.ticket-actions .btn-xs {
    width: 100%;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 38px !important;
    padding: 8px 10px !important;
    font-size: 0.88rem !important;
    transition: transform 0.18s var(--ease), filter 0.18s var(--ease);
}
.ticket-actions .btn-xs:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
}
.ticket-actions .btn-xs:active { transform: translateY(1px) scale(0.98); }

/* توافق قديم */
.ticket-head, .ticket-meta, .ticket-body, .ticket-zone, .ticket-zone-id, .ticket-zone-info, .ticket-zone-actions,
.order-wa-note, .order-facts, .order-status-chip, .chip, .chip-time { display: none; }

.btn-xs, .btn-outline, .btn-success, .btn-danger, .btn-primary-act, .btn-copy-cliche {
    border-radius: 10px !important;
    font-family: var(--font-ui) !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    padding: 9px 13px !important;
    min-height: 42px;
    cursor: pointer;
}
.btn-primary-act, .btn-copy-cliche { background: var(--ink) !important; color: #fff !important; border: 0 !important; }
.btn-success { background: var(--harbor) !important; color: #fff !important; border: 0 !important; }
.btn-outline { background: #fff !important; border: 1px solid var(--border) !important; color: var(--ink) !important; }
.btn-danger {
    background: rgba(196,60,60,0.1) !important;
    color: var(--danger) !important;
    border: 1px solid rgba(196,60,60,0.25) !important;
}
.icon-xs { font-size: 18px !important; }
.icon-lg { font-size: 42px !important; }

.order-board-empty .empty-state {
    display: grid;
    place-items: center;
    gap: 10px;
    padding: var(--space-6) var(--space-4);
    border: 1px dashed rgba(11,31,42,0.18);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.75);
    text-align: center;
}
.order-board-empty .msg {
    color: var(--harbor-deep) !important;
    font-size: 1.25rem !important;
    font-weight: 800 !important;
}
.empty-hint { color: var(--text-muted); font-size: 1.05rem; }

.review-stage {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 100%;
}
.review-composer {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 14px;
    padding: 16px 18px;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.96) 0%, rgba(236, 245, 246, 0.92) 100%);
    border: 1px solid rgba(11, 31, 42, 0.08);
    box-shadow: 0 10px 28px rgba(11, 31, 42, 0.04);
}
.review-composer-fields {
    display: grid;
    grid-template-columns: minmax(140px, 0.9fr) minmax(140px, 0.9fr) minmax(220px, 1.4fr);
    gap: 12px;
    flex: 1 1 520px;
}
.review-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.review-field span {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--harbor-deep);
    letter-spacing: 0.02em;
}
.review-field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(11, 31, 42, 0.12);
    background: #fff;
    font: 700 1.02rem var(--font-ui);
    color: var(--ink);
    outline: none;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.review-field input:focus {
    border-color: rgba(30, 90, 120, 0.45);
    box-shadow: 0 0 0 3px rgba(30, 90, 120, 0.12);
}
.review-composer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px;
    flex: 0 0 auto;
    white-space: nowrap;
}
.review-composer-btn .material-symbols-rounded {
    font-size: 1.2rem;
}
.review-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
}
.review-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 280px;
    max-width: 420px;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.88);
    border: 1px solid rgba(11, 31, 42, 0.1);
}
.review-filter .material-symbols-rounded {
    color: var(--text-muted);
    font-size: 1.15rem;
}
.review-filter input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: none;
    font: 600 0.98rem var(--font-ui);
    color: var(--ink);
}
.review-list-meta {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-muted);
}
.review-list {
    min-height: 180px;
    flex: 1;
}
.review-ticket {
    --accent: var(--brass, #b8892d);
}
.review-ticket .ticket-group {
    background: #1f3a44;
    border-bottom-color: var(--brass, #b8892d);
}
.review-ticket .ticket-actions a.btn-outline {
    text-decoration: none;
}
@media (max-width: 980px) {
    .review-composer-fields {
        grid-template-columns: 1fr;
    }
    .review-composer-btn {
        width: 100%;
    }
}

.tool-block {
    background: var(--paper);
    border: var(--line);
    border-radius: var(--radius);
    padding: var(--space-4);
    box-shadow: var(--shadow);
}
.search-box { display: flex; gap: var(--space-2); margin-bottom: var(--space-4); }
.search-box input {
    flex: 1;
    padding: 15px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font: 600 1.15rem var(--font-ui);
}
.btn-primary {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 14px 22px;
    background: var(--ink);
    color: #fff;
    font: 700 1.1rem var(--font-ui);
    cursor: pointer;
}
.search-block {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
}
.wasl-results { display: flex; flex-direction: column; gap: var(--space-3); }
.search-grid { width: 100%; }
.search-ticket .ticket-group {
    background: var(--ink);
}
.wasl-result-card {
    background: #f7fbfb;
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    border: var(--line);
    font-size: 1.08rem;
    line-height: 1.6;
}
.wasl-result-card strong { font-size: 1.25rem; }
.wasl-moves { margin-top: 10px; display: grid; gap: 6px; color: var(--text-muted); }

.toast-container {
    position: fixed;
    top: 16px;
    inset-inline-end: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: var(--ink);
    color: #fff;
    padding: 14px 18px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.05rem;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

.wa-connect-screen {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 80;
    padding: var(--space-5);
    overflow: auto;
}
.wa-connect-screen.active { display: flex; }
.wa-connect-stage {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 55% at 50% 12%, rgba(26, 166, 160, 0.32), transparent 58%),
        linear-gradient(165deg, #071820 0%, #123847 48%, #0c3f3c 100%);
}
.wa-connect-stage::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 40%;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.35));
    pointer-events: none;
}
.wa-connect-compose {
    position: relative;
    z-index: 2;
    width: min(420px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: #fff;
    gap: var(--space-2);
    animation: waStageIn 0.55s var(--ease) both;
}
.wa-connect-mark {
    width: clamp(120px, 28vw, 150px);
    height: auto;
    display: block;
    background: #fff;
    border-radius: 50%;
    padding: 14px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.3);
    margin-bottom: 4px;
}
.wa-connect-brand {
    margin: 0;
    font-family: var(--font-brand);
    font-size: clamp(1.7rem, 4vw, 2.1rem);
    font-weight: 700;
    line-height: 1;
}
.wa-connect-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.16);
    color: rgba(255,255,255,0.92);
    font-size: 0.92rem;
    font-weight: 700;
}
.wa-connect-badge .wa-live-dot {
    background: #f0c14b;
    box-shadow: 0 0 0 4px rgba(240, 193, 75, 0.2);
    animation: pulseLive 1.6s var(--ease) infinite;
}
.wa-connect-badge.online .wa-live-dot {
    background: #3dd68c;
    box-shadow: 0 0 0 4px rgba(61, 214, 140, 0.22);
}
.wa-connect-title {
    margin: 10px 0 0;
    font-family: var(--font-brand);
    font-size: clamp(1.45rem, 3.5vw, 1.75rem);
    font-weight: 600;
    color: rgba(255,255,255,0.95);
}
.wa-connect-sub {
    margin: 0;
    color: rgba(255,255,255,0.72);
    font-size: 1.05rem;
    max-width: 28ch;
}
.wa-connect-qr {
    width: min(260px, 72vw);
    height: auto;
    margin: 10px auto 0;
    border-radius: 18px;
    border: 6px solid #fff;
    box-shadow: 0 18px 40px rgba(0,0,0,0.28);
    background: #fff;
}
.wa-qr-loading {
    margin-top: 8px;
    min-height: 120px;
    width: min(260px, 72vw);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: rgba(255,255,255,0.75);
    font-weight: 700;
    font-size: 1.05rem;
    border: 1px dashed rgba(255,255,255,0.28);
    border-radius: 18px;
    background: rgba(255,255,255,0.05);
}
.wa-spin {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    animation: spinSoft 0.8s linear infinite;
}
.wa-connect-status {
    margin: 4px 0 0;
    color: rgba(255,255,255,0.62);
    font-size: 0.95rem;
    min-height: 1.4em;
}
.wa-connect-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: var(--space-3);
    width: 100%;
}
.btn-wa {
    border: 0;
    border-radius: 12px;
    padding: 13px 18px;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font: 700 1.02rem var(--font-ui);
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.16);
    transition: transform 0.18s var(--ease), background 0.18s var(--ease);
}
.btn-wa:hover { transform: translateY(-1px); background: rgba(255,255,255,0.18); }
.btn-wa-enter {
    background: var(--harbor);
    border-color: transparent;
    min-width: 160px;
}
.btn-wa-enter:hover { background: var(--harbor-deep); }
.btn-wa-ghost { background: transparent; }
.btn-danger-wa {
    background: rgba(196, 60, 60, 0.22);
    border-color: rgba(255,140,140,0.35);
}

@media (max-width: 980px) {
    body.app-ready { overflow: auto; }
    .app-shell {
        height: auto;
        min-height: 100vh;
        grid-template-columns: 1fr;
    }
    .nav-group { flex-direction: row; flex-wrap: wrap; }
    .menu-item { flex: 1 1 150px; }
    .workspace-pages, .page-panel, .page-canvas { height: auto; overflow: visible; }
    .workspace-bar { flex-direction: column; align-items: stretch; }
    .workspace-bar-side { align-items: stretch; }
    .status-strip { width: 100%; }
    .status-host { align-self: flex-start; }
    .ticket-grid { gap: 12px; }
    .order-card.ticket {
        min-height: 0;
    }
    .ticket-row {
        grid-template-columns: 1fr;
    }
    .ticket-rail {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        border-inline-end: 0;
        border-bottom: 1px solid rgba(11, 31, 42, 0.06);
        padding: 12px 14px;
    }
    .ticket-actions {
        flex-direction: row;
        flex-wrap: wrap;
        border-inline-start: 0;
        border-top: 1px solid rgba(11, 31, 42, 0.06);
        min-width: 0;
    }
    .ticket-actions .btn-xs,
    .ticket-actions .btn-moves { width: auto; flex: 1 1 120px; }
    .login-mark { width: clamp(210px, 48vw, 260px); }
}
