/* سونك للكافيهات: ما يخص الكافيه فوق تصميم سونك الموحد (app.css وsonic_*.css).
   الألوان والبطاقات والحقول والتنبيهات من ملفات سونك نفسها، وهذا الملف يربط بها عناصر الكافيه فقط. */
body{font-size:var(--cafe-font,14px)}
.table{font-size:var(--cafe-table-font,14px)}
.num{direction:ltr;unicode-bidi:isolate;font-variant-numeric:tabular-nums;white-space:nowrap}
.is-busy{opacity:.6;pointer-events:none}
.cafe-bare{background:var(--bs-body-bg)}
.cafe-offline{position:fixed;bottom:18px;right:50%;transform:translateX(50%);z-index:3000;background:#FF2F26;color:#fff;padding:10px 20px;border-radius:12px;font-weight:800}
.select2-container{z-index:1060}.select2-container--open{z-index:1070}
.select2-container:not(.select2-container--open){z-index:auto}
.customer-opt b{display:block}.customer-opt small{opacity:.75}
.table>tbody>tr[data-open]{cursor:pointer}

/* ---------- الهوية في القائمة الجانبية والشريط العلوي ---------- */
.sonic-sidebar-matdash-brand{display:inline-flex;align-items:center;gap:10px;max-width:100%}
.sonic-brand-mark{width:36px;height:36px;object-fit:contain;border-radius:10px;flex:0 0 auto}
.sonic-brand-name{font-weight:800;font-size:16px;line-height:1.25;color:var(--bs-heading-color);white-space:normal;overflow-wrap:anywhere}
.cafe-brand-logo{max-width:170px;max-height:44px;object-fit:contain}
.sonic-mobile-header-brand{display:none;align-items:center;gap:8px;text-decoration:none}
.sonic-mobile-header-brand .sonic-brand-mark{width:32px;height:32px}
@media(max-width:1299.98px){.sonic-mobile-header-brand{display:inline-flex}}
@media(max-width:991.98px){.sonic-mobile-header-brand .sonic-brand-name{display:none}}
[data-sidebartype=mini-sidebar] .side-mini-panel:not(:hover) .sonic-brand-name{display:none}
.cafe-center-btn{display:inline-flex;align-items:center;gap:8px;min-height:40px;padding:6px 14px;border-radius:12px;background:var(--bs-primary-bg-subtle);color:var(--bs-primary);font-weight:800;max-width:240px;text-decoration:none}
.cafe-center-btn span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media(max-width:991.98px){.sonic-original-header-start{flex-wrap:nowrap!important;flex-direction:row!important}.cafe-center-btn{max-width:42vw}}
.cafe-avatar{width:35px;height:35px;border-radius:50%;background:linear-gradient(135deg,#2563eb,#4f46e5);color:#fff;display:inline-flex;align-items:center;justify-content:center;font-weight:800;flex:0 0 auto}
.cafe-avatar.sonic-profile-menu-avatar{width:56px;height:56px;font-size:22px}
.cafe-bell-badge{position:absolute;top:2px;inset-inline-end:0;min-width:18px;height:18px;font-size:10px;padding:0 5px}
.sonic-section-closed>.sonic-sidebar-section-menu{display:none!important}
.sonic-search-links{max-height:60vh;overflow:auto}
.sonic-search-links small{font-weight:600}

/* ---------- عنوان الصفحة ---------- */
.sonic-heading-sub{position:relative;z-index:1;color:var(--bs-secondary-color);font-weight:600;line-height:1.7}
.sonic-page-heading>.sonic-head-actions{position:relative;z-index:1;display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:flex-end}
.sonic-head-actions .btn{min-height:42px;display:inline-flex;align-items:center;justify-content:center;gap:4px;font-weight:800}
@media(max-width:767.98px){.sonic-page-heading{flex-direction:column}.sonic-page-heading>.sonic-head-actions{width:100%;justify-content:stretch}.sonic-head-actions .btn{flex:1 1 auto}}

/* ---------- البطاقات الإحصائية ---------- */
a.machinery-stat-card-v263{color:#fff!important;text-decoration:none!important;transition:transform .18s ease,box-shadow .18s ease}
a.machinery-stat-card-v263:hover{transform:translateY(-2px);box-shadow:0 14px 30px rgba(15,23,42,.16)}
.machinery-stat-card-v263>strong.num{direction:ltr;display:block}
.cafe-stat-small .machinery-stat-card-v263>strong{font-size:19px!important}
/* كل صف ممتلئ: الأعمدة من الخادم (--k للحاسوب، --km للوحي)، وبطاقتان على الهاتف، والأخيرة تأخذ الصف إن بقيت وحدها */
html body .machinery-stat-grid-v263.sonic-stat-auto{display:flex!important;flex-wrap:wrap;gap:16px;grid-template-columns:none!important}
html body .machinery-stat-grid-v263.sonic-stat-auto>*{flex:1 1 calc((100% - (var(--k,4) - 1) * 16px) / var(--k,4));min-width:0;max-width:100%}
@media(max-width:1199.98px){html body .machinery-stat-grid-v263.sonic-stat-auto>*{flex-basis:calc((100% - (var(--km,3) - 1) * 16px) / var(--km,3))}}
@media(max-width:575.98px){html body .machinery-stat-grid-v263.sonic-stat-auto{gap:10px}html body .machinery-stat-grid-v263.sonic-stat-auto>*{flex-basis:calc(50% - 5px)}}

/* ---------- الحقول: نفس الارتفاع والعنوان العريض ---------- */
.form-label{font-weight:800;color:var(--bs-heading-color)}
.form-control:not(textarea):not(.form-control-sm):not(.form-control-lg):not([type=file]),.form-select:not(.form-select-sm):not([multiple]):not([size]){min-height:46px}
.form-control,.form-select{border-radius:12px}
.cafe-switch{display:flex;align-items:center;gap:10px;min-height:46px;padding:0 14px;border:1px solid var(--bs-border-color);border-radius:12px;background:var(--bs-body-bg);font-weight:700}
.cafe-switch .form-check-input{margin:0;flex:none;float:none}
.cafe-switch .form-check-label{margin:0;cursor:pointer}
.cafe-switch:has(input:checked){border-color:var(--bs-primary);background:var(--bs-primary-bg-subtle)}
.form-text{line-height:1.6}

/* ---------- الأزرار في فوتر البطاقة ---------- */
.card>.card-footer,.card>form>.card-footer{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:10px;min-height:68px;padding:14px 18px;background:var(--bs-tertiary-bg);border-top:1px solid var(--bs-border-color)}
.card>.card-footer .btn,.card>form>.card-footer .btn,.sonic-card-footer .btn{min-width:150px;min-height:44px;display:inline-flex;align-items:center;justify-content:center;gap:6px;font-weight:800}
.card-footer .me-auto,.sonic-card-footer .me-auto{margin-inline-end:auto!important}
@media(max-width:575.98px){.card>.card-footer .btn,.card>form>.card-footer .btn,.sonic-card-footer .btn{flex:1 1 100%;min-width:0}}

/* ---------- النوافذ: رأس وفوتر بلون هادئ وأزرار بنفس الحجم ---------- */
.modal-content{border:0;border-radius:16px;overflow:hidden}
.modal-header,.modal-footer{background:var(--bs-tertiary-bg)}
.modal-header .modal-title{font-weight:800}
.modal-body{padding:1.1rem}
.modal-footer{gap:.5rem;padding:.85rem 1.1rem}
.modal-footer>*{margin:0}
.modal-footer .btn{min-height:42px;min-width:120px;font-weight:800;display:inline-flex;align-items:center;justify-content:center;gap:.35rem}
@media(max-width:575.98px){.modal-footer .btn{flex:1 1 auto;min-width:0}}

/* ---------- الجداول ---------- */
.table>thead>tr>th{white-space:nowrap;font-weight:800}
.table td .btn-sm{padding:4px 9px}
.table td form.sonic-inline-form{display:inline-flex}
.sonic-empty-row>td{padding:0!important}
.sonic-empty-row .sonic-empty-fast{min-height:140px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;color:var(--bs-secondary-color);padding:24px}
.sonic-empty-row .sonic-empty-fast>i{font-size:30px;color:var(--bs-primary);opacity:.75}
.sonic-empty-row .sonic-empty-fast strong{font-weight:700;color:var(--bs-secondary-color);margin:0}
.card>.sonic-table-pagination-v1042:last-child,.card .sonic-table-pagination-v1042:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}
.sticky-actions{position:sticky;bottom:0;background:var(--bs-body-bg);padding:12px 0;z-index:5;border-top:1px solid var(--bs-border-color)}
@media print{.no-print,.sonic-mobile-table-view-switch{display:none!important}.page-wrapper,.body-wrapper{margin:0!important;padding:0!important}.card{box-shadow:none!important;border:0!important}}

/* ---------- الحسابات ---------- */
.acc-debit{color:#d1383d;font-weight:700}.acc-credit{color:#0d8049;font-weight:700}
.acc-total>td{font-weight:800;background:var(--bs-tertiary-bg)}
.acc-dl dt{font-weight:600;color:var(--bs-secondary-color);padding-block:4px}.acc-dl dd{font-weight:600;margin:0;padding-block:4px}
.acc-debts{max-height:260px;overflow:auto;border:1px solid var(--bs-border-color);border-radius:10px}
.acc-debt{display:flex;align-items:center;gap:10px;padding:9px 12px;cursor:pointer;border-bottom:1px solid var(--bs-border-color)}.acc-debt:last-of-type{border-bottom:0}.acc-debt span{flex:1}.acc-debt:hover{background:var(--bs-tertiary-bg)}.acc-debt input{flex:none;margin:0}.acc-debt small{display:block}
.acc-diff td{vertical-align:top;word-break:break-word}.acc-diff tr.chg>td{background:#f59f0018}
.report-filter .form-label{margin-bottom:4px}
.select2-container:not(.select2-container--open){z-index:auto} /* كي لا تظهر حقول الصفحة فوق النوافذ */
.perm-grid{columns:3 340px;column-gap:16px}.perm-box{break-inside:avoid}.perm-row{border-bottom:1px solid var(--bs-border-color)}.perm-row:last-child{border:0}
.bk-bar{height:14px;border-radius:14px;background:var(--bs-border-color);overflow:hidden}.bk-bar i{display:block;height:100%;width:0;background:var(--bs-primary);transition:width .4s}@media(max-width:767.98px){.msg-cut{max-width:210px}}

/* ------------------------------------------------ شاشة البيع */
.sonic-page-pos .body-wrapper > .container-fluid { padding-bottom: .5rem; }
.sonic-page-pos .sonic-app-footer { display: none; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: .75rem; height: calc(100vh - 190px); min-height: 520px; }
.pos .card { display: flex; flex-direction: column; overflow: hidden; }
.pos-top { display: flex; gap: .5rem; padding: .6rem; border-bottom: 1px solid var(--bs-border-color); align-items: center; flex-wrap: wrap; }
.pos-types .btn { font-weight: 700; padding: .45rem .9rem; }
.pos-search { position: relative; flex: 1; min-width: 180px; }
.pos-search i { position: absolute; inset-inline-start: .7rem; top: 50%; transform: translateY(-50%); opacity: .5; }
.pos-search input { padding-inline-start: 2.1rem; }
.pos-body { display: flex; flex: 1; min-height: 0; }
.pos-cats { width: 150px; overflow-y: auto; padding: .5rem; border-inline-end: 1px solid var(--bs-border-color); display: flex; flex-direction: column; gap: .35rem; }
.pos-cat { --c: var(--bs-primary); border: 0; border-inline-start: 4px solid var(--c); background: var(--bs-tertiary-bg); color: inherit; text-align: start; padding: .6rem .6rem; border-radius: .5rem; font-weight: 600; font-size: .92rem; }
.pos-cat.active { background: var(--c); color: #fff; }
.pos-items { flex: 1; overflow-y: auto; padding: .6rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: .5rem; align-content: start; }
.pos-item { --c: var(--bs-primary); border: 1px solid var(--bs-border-color); border-top: 4px solid var(--c); background: var(--bs-body-bg); border-radius: .6rem; padding: .55rem .5rem; min-height: 86px; display: flex; flex-direction: column; justify-content: space-between; text-align: center; color: inherit; transition: transform .08s; }
.pos-item:active { transform: scale(.96); }
.pos-item:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.pos-item img { width: 100%; height: 74px; object-fit: cover; border-radius: .4rem; margin-bottom: .3rem; }
.pos-item .n { font-weight: 700; font-size: .93rem; line-height: 1.35; }
.pos-item .p { color: var(--bs-success); font-weight: 700; font-size: .9rem; }
.pos-order .pos-head { display: flex; justify-content: space-between; gap: .5rem; padding: .6rem .75rem; border-bottom: 1px solid var(--bs-border-color); }
.pos-cust { padding: .5rem .75rem; border-bottom: 1px solid var(--bs-border-color); }
.pos-lines { flex: 1; overflow-y: auto; min-height: 120px; }
.pos-line { display: grid; grid-template-columns: 1fr auto 82px; gap: .4rem; align-items: center; padding: .45rem .75rem; border-bottom: 1px dashed var(--bs-border-color); cursor: pointer; }
.pos-line:hover { background: var(--bs-tertiary-bg); }
.pl-name small { display: block; font-size: .78rem; color: var(--bs-secondary-color); }
.pl-qty { display: flex; align-items: center; gap: .25rem; }
.pl-qty .btn { width: 28px; height: 28px; padding: 0; font-weight: 700; }
.pl-qty span { min-width: 2rem; text-align: center; font-weight: 700; }
.pl-total { text-align: end; font-weight: 700; }
.pos-empty { text-align: center; padding: 2.5rem 1rem; color: var(--bs-secondary-color); }
.pos-empty i { font-size: 2.4rem; display: block; margin-bottom: .5rem; opacity: .5; }
.pos-sum { border-top: 1px solid var(--bs-border-color); padding: .5rem .75rem .75rem; background: var(--bs-tertiary-bg); }
.pos-sum-grid > div { display: flex; justify-content: space-between; align-items: center; padding: .15rem 0; }
.pos-disc select { width: 4.2rem; } .pos-disc input { width: 6.5rem; }
.pos-total { font-size: 1.3rem; border-top: 1px solid var(--bs-border-color); margin-top: .25rem; padding-top: .35rem !important; }
.pos-total b { color: var(--bs-primary); }
.pos-actions { display: grid; grid-template-columns: 1fr 1fr auto; gap: .4rem; margin-top: .5rem; }
.pos-actions .btn { font-weight: 700; padding: .65rem .5rem; }
.pos-actions small { opacity: .7; font-weight: 400; }
.pos-mods { display: flex; flex-wrap: wrap; gap: .4rem; }
.pos-mod { border: 1px solid var(--bs-border-color); background: var(--bs-body-bg); color: inherit; border-radius: 2rem; padding: .35rem .8rem; }
.pos-mod.on { background: var(--bs-primary-bg-subtle); border-color: var(--bs-primary); color: var(--bs-primary-text-emphasis); font-weight: 700; }
.pos-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .6rem; }
.pos-table { position: relative; border: 2px solid; border-radius: .7rem; padding: .7rem .4rem; min-height: 88px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; background: var(--bs-body-bg); color: inherit; }
.pos-table b { font-size: 1.25rem; }
.pos-table.cur { box-shadow: 0 0 0 3px var(--bs-primary); }
.t-free { border-color: #2fb36a !important; } .t-busy { border-color: #e5484d !important; background: rgba(229,72,77,.07) !important; } .t-res { border-color: #f5a524 !important; background: rgba(245,165,36,.08) !important; }
.pos-legend span { display: inline-block; width: 12px; height: 12px; border: 2px solid; border-radius: 3px; vertical-align: middle; margin-inline-start: .6rem; }
.t-unsent { position: absolute; top: 6px; inset-inline-end: 6px; color: #f5a524; }
.pay-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.pay-top > div { background: var(--bs-tertiary-bg); border-radius: .6rem; padding: .6rem; text-align: center; }
.pay-top span { display: block; font-size: .85rem; color: var(--bs-secondary-color); }
.pay-top b { font-size: 1.35rem; }
.pay-notes { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.pay-ret { display: flex; justify-content: space-between; font-size: 1.3rem; font-weight: 700; color: var(--bs-success); background: var(--bs-success-bg-subtle); border-radius: .6rem; padding: .5rem .8rem; margin-bottom: .4rem; }
@media (max-width: 991.98px) { .pos { grid-template-columns: 1fr; height: auto; } .pos-menu { height: 60vh; } .pos-cats { width: 110px; } .pos-order { min-height: 70vh; } }

/* ------------------------------------------------ شاشة المطبخ */
.kds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.kds-col { background: var(--bs-tertiary-bg); border-radius: .8rem; padding: .6rem; min-height: 60vh; }
.kds-col h6 { font-weight: 800; margin: .2rem .2rem .6rem; }
.kds-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; align-content: start; }
.kds-card { background: var(--bs-body-bg); border-radius: .7rem; border-top: 5px solid #635bff; padding: .6rem; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.kds-col[data-s=preparing] .kds-card { border-top-color: #f5a524; } .kds-col[data-s=ready] .kds-card { border-top-color: #2fb36a; opacity: .85; }
.kds-card.late { border-top-color: #e5484d; animation: kdsLate 1.6s infinite; }
@keyframes kdsLate { 50% { box-shadow: 0 0 0 3px rgba(229,72,77,.35); } }
.kds-h { display: flex; justify-content: space-between; font-size: 1.05rem; }
.kds-q { display: inline-block; background: #000; color: #fff; border-radius: .4rem; padding: 0 .45rem; margin-inline-end: .35rem; }
.kds-sub { font-size: .8rem; color: var(--bs-secondary-color); margin-bottom: .35rem; }
.kds-l { display: flex; gap: .5rem; padding: .25rem 0; border-bottom: 1px dashed var(--bs-border-color); font-size: 1.05rem; }
.kds-l b { min-width: 1.8rem; } .kds-l small { display: block; font-size: .82rem; } .kds-l em { font-style: normal; font-size: .75rem; background: #f5a524; color: #000; border-radius: .3rem; padding: 0 .3rem; }
.kds-deleted span { text-decoration: line-through; color: #e5484d; } .kds-deleted em { background: #e5484d; color: #fff; }
.kds-note { margin-top: .35rem; font-size: .85rem; background: var(--bs-warning-bg-subtle); border-radius: .4rem; padding: .2rem .4rem; }
.kds-a { display: flex; gap: .35rem; margin-top: .5rem; }
@media (max-width: 991.98px) { .kds { grid-template-columns: 1fr; } }
.q-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.q-card { border: 1px solid var(--bs-border-color); border-radius: .6rem; padding: .5rem; text-align: center; }
.q-card b { font-size: 1.8rem; display: block; line-height: 1.2; } .q-card small { display: block; font-size: .75rem; color: var(--bs-secondary-color); }
.q-ready { border-color: #2fb36a; background: rgba(47,179,106,.07); } .q-done { opacity: .6; }
.cafe-brand-logo{scale:1!important;width:auto!important;max-width:170px!important;height:40px!important}
.sonic-page-heading .breadcrumb-item+.breadcrumb-item::before{content:"/";float:right;padding-left:.5rem;color:var(--bs-secondary-color)}
/* عنوان بسطر واحد لشاشات العمل (الكاشير والمطبخ) حتى تبقى المساحة للعمل */
.sonic-page-heading.sonic-page-heading-compact{padding:10px 18px;margin-bottom:12px!important;min-height:0}
.sonic-page-heading-compact::after,.sonic-page-heading-compact .breadcrumb,.sonic-page-heading-compact .sonic-heading-sub{display:none!important}
.sonic-page-heading-compact>div:first-child{display:flex;align-items:center;gap:10px;flex:1 1 auto;min-width:0}
.sonic-page-heading-compact>div:first-child>div{margin:0!important}
.sonic-page-heading-compact h1{font-size:1.2rem!important;margin:0!important}
.sonic-page-heading-compact .sonic-head-actions .btn,.sonic-page-heading-compact .sonic-head-actions .form-select{min-height:38px}
/* الهاتف: زر الفرع أيقونة فقط حتى لا يغطيه شعار البرنامج في وسط الشريط */
@media(max-width:767.98px){.cafe-center-btn{padding:6px 10px}.cafe-center-btn>span,.cafe-center-btn>.ti-chevron-down{display:none}}
/* عنوان البطاقة المكتوب أول سطر في جسمها يظهر شريط رأس مثل card-header في سونك */
.card>.card-body>h5:first-child,.card>.card-body>h6:first-child,.card>.card-body>.card-title:first-child{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-height:58px;margin:calc(-1 * var(--bs-card-spacer-y)) calc(-1 * var(--bs-card-spacer-x)) 1.25rem!important;padding:.85rem var(--bs-card-spacer-x);border-bottom:1px solid var(--bs-border-color);font-size:1rem;font-weight:800;color:var(--bs-heading-color)}
.card>.card-body.pb-0>h5:first-child:last-child{margin-bottom:0!important;border-bottom:0}
/* الوضع الليلي: قالب MatDash يترك لون العناوين فارغًا فتظهر روابط القائمة والعناوين داكنة على خلفية داكنة */
html[data-bs-theme=dark]{--bs-heading-color:rgba(255,255,255,.88)}
html[data-bs-theme=dark] .sonic-single-sidebar .sidebar-item,html[data-bs-theme=dark] .sonic-single-sidebar .sidebar-link{color:rgba(255,255,255,.82)}
