/* ==========================================================================
   DataGris Store — مكوّنات الشاشات الكاملة (فوق styles.css)
   كل القيم من التوكنز؛ مسافات على شبكة 4/8.
   ========================================================================== */

/* ---------- عام ---------- */
#view { zoom: var(--fs-scale, 1); }
.muted { color: var(--muted); }
.tone-ok { color: var(--ok-text); }
.tone-warn { color: var(--warn-text); }
.tone-danger { color: var(--danger-text); }
.tone-primary { color: var(--primary); }
.cur { font-size: .78em; font-weight: 500; color: var(--muted); }
.hide-phone { }
code { font: 600 12px "Google Sans", monospace; background: var(--canvas); padding: 1px 6px; border-radius: 6px; direction: rtl; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 4px 0; width: 100%; }
.sec-title { font-size: 17px; font-weight: 700; margin: 8px 0 12px; display: flex; align-items: center; gap: 8px; }
.sec-title small { font-size: 12.5px; font-weight: 500; }
.w-180 { width: 180px; } .w-220 { width: 220px; } .w-260 { width: 260px; }
.grow { flex: 1; min-width: 200px; }
.link { color: var(--primary); font-weight: 600; font-size: 13px; padding: 4px 6px; border-radius: 8px; }
.link:hover { background: var(--primary-soft); }
.desc { display: inline-block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; color: var(--text-2); }
.is-cleared .table-card, .is-cleared .stats { opacity: .72; }
.sys-banner { padding: 0 8px 8px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-cards { display: flex; flex-direction: column; gap: 16px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- الكثافة ---------- */
.density-compact .card { padding: 14px 16px; }
.density-compact .stats { gap: 10px; margin-bottom: 12px; }
.density-compact .stat { padding: 10px 12px; }
.density-compact tbody td { padding: 6px 14px; }
.density-compact .content { padding-top: 0; }
.density-compact .kpis, .density-compact .grid-2-1, .density-compact .grid-3 { gap: 10px; margin-bottom: 10px; }

/* ---------- أزرار إضافية ---------- */
.btn.btn-sm { height: 32px; padding-inline: 12px; font-size: 12.5px; border-radius: 10px; gap: 6px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.btn-soft { background: var(--primary-soft); color: var(--primary); border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent); }
.btn-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 14%, var(--surface)); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn.danger { color: var(--danger-text); }
.icon-btn.danger:hover { background: var(--danger-soft); }
.icon-btn.primary { color: var(--primary); background: var(--primary-soft); }
.icon-btn.wa { color: #128C4A; }
:root[data-theme="dark"] .icon-btn.wa { color: #4ADE80; }
.acts { display: inline-flex; gap: 2px; align-items: center; justify-content: flex-end; flex-wrap: nowrap; }
.copy { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; margin-inline-start: -8px; border-radius: 8px; color: var(--text); }
.copy .ic { color: var(--muted); }
.copy:hover { background: var(--canvas); }

/* ---------- حالات وشارات ---------- */
.status.info { background: color-mix(in srgb, #0E7490 12%, transparent); color: #0B6A84; }
:root[data-theme="dark"] .status.info { color: #38BDF8; background: rgba(56, 189, 248, .12); }
.status.neutral { background: var(--canvas); color: var(--text-2); }
.status.primary { background: var(--primary-soft); color: var(--primary); }
.tab-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding-inline: 6px; margin-inline-start: 4px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; vertical-align: 1px; }
.tile.tone-ok { background: var(--ok-soft); color: var(--ok-text); }
.tile.tone-warn { background: var(--warn-soft); color: var(--warn-text); }
.tile.tone-danger, .tile.tone-out { background: var(--danger-soft); color: var(--danger-text); }
.tile.tone-info { background: color-mix(in srgb, #0E7490 12%, transparent); color: #0B6A84; }
:root[data-theme="dark"] .tile.tone-info { color: #38BDF8; background: rgba(56, 189, 248, .12); }
.tile.tone-primary { background: var(--primary-soft); color: var(--primary); }
.tile.tone-neutral, .tile:not([class*="cat-"]):not([class*="tone-"]) { background: var(--canvas); color: var(--text-2); }
.tile.danger { background: var(--danger-soft) !important; color: var(--danger-text) !important; }

/* ---------- أفاتار ---------- */
.avatar { width: 40px; height: 40px; font-size: 15px; background: var(--av-bg, var(--primary-soft)); color: var(--av-fg, var(--primary)); }
.avatar.xs { width: 24px; height: 24px; font-size: 11px; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }
.avatar.xl { width: 84px; height: 84px; font-size: 32px; }
.av-1 { --av-bg: #F2FBE1; --av-fg: #4A7A0C; } .av-2 { --av-bg: #E0F2FE; --av-fg: #0B6AA2; } .av-3 { --av-bg: #DCFAE6; --av-fg: #067647; }
.av-4 { --av-bg: #FCE7F6; --av-fg: #A11C7C; } .av-5 { --av-bg: #E9E5FF; --av-fg: #4F3CC9; } .av-6 { --av-bg: #FEF0C7; --av-fg: #93370D; }
:root[data-theme="dark"] .avatar { --av-bg: rgba(255, 255, 255, .08); --av-fg: var(--text); }
.av-stack { display: inline-flex; }
.av-stack .avatar { border: 2px solid var(--surface); margin-inline-start: -8px; }
.av-stack .avatar:first-child { margin-inline-start: 0; }

/* ---------- شريط الصفحة / فلاتر ---------- */
.pagebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pagebar-start { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; flex-wrap: wrap; }
.pagebar-end { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pagebar .field { height: 42px; }
.pagebar .sec-title { margin: 0; }
.bar-lbl { font-size: 13px; color: var(--muted); font-weight: 500; }
.chips { margin-bottom: 12px; }
.pagebar .chips { margin-bottom: 0; }
.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-row .chips { margin-bottom: 0; }
.filter-info { font-size: 13px; color: var(--muted); }
.field.sel select { padding-inline-end: 4px; }
.field .ic.sm { color: var(--muted); }

/* ---------- إحصائيات صغيرة ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-card); min-width: 0; }
.stat-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--canvas); color: var(--text-2); }
.stat.tone-primary .stat-ico { background: var(--primary-soft); color: var(--primary); }
.stat.tone-ok .stat-ico { background: var(--ok-soft); color: var(--ok-text); }
.stat.tone-warn .stat-ico { background: var(--warn-soft); color: var(--warn-text); }
.stat.tone-danger .stat-ico { background: var(--danger-soft); color: var(--danger-text); }
.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-lbl { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-val { font-size: 20px; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; white-space: nowrap; }
.stat-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-strong { border-color: var(--primary); }

/* ---------- كروت KPI (لوحة التحكم) — الرسم في سطر لوحده، ما يغطيش على النص ---------- */
.kpi { min-height: 0; gap: 0; }
.kpi .kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .lbl { font-size: 13px; color: var(--muted); font-weight: 500; display: block; }
.kpi .val { margin-top: 8px; }
.kpi .val-name { font-size: 22px; line-height: 1.35; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi .foot { margin-top: 10px; flex-wrap: wrap; row-gap: 6px; }
.kpi svg.spark { position: static; display: block; width: calc(100% + 40px); height: 44px; margin: 14px -20px 0; margin-top: auto; padding-top: 14px; box-sizing: content-box; }
.kpi.has-spark { padding-bottom: 0; }
.kpi:not(.has-spark) .foot { margin-top: auto; padding-top: 10px; }
.kpis .kpi { display: flex; flex-direction: column; }
.kpi.hero .pill.up, .kpi.hero .pill.down { background: rgba(16, 24, 40, .08); color: #101828; }
.kpi.dark .pill.neutral { background: rgba(255, 255, 255, .1); color: #fff; }
.pill .num { font-size: inherit; }

/* ---------- رسم المبيعات ---------- */
.chart-read { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -6px 0 8px; min-height: 28px; }
.chart-read b { font-size: 20px; }
.chart-read > span { font-size: 12.5px; color: var(--muted); }
.chart-wrap { padding-top: 4px; }
.chart-tip { transform: none; }
.grid-line.guide { stroke: var(--faint); stroke-dasharray: 3 4; opacity: 0; transition: opacity var(--t-fast); }
.cols-cap { margin-top: 6px; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; justify-content: center; }
.peak-cols { height: 150px; padding-top: 24px; }
.legend { list-style: none; margin: 0; padding: 0; }

/* ---------- لوحة التحكم: أونلاين/صافي/عمليات ---------- */
.oo-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.oo-sum div { background: var(--canvas); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.oo-sum span { font-size: 12px; color: var(--muted); }
.oo-sum b { font-size: 22px; }
.oo-bars { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.oo-row { display: grid; grid-template-columns: 92px 1fr 24px; align-items: center; gap: 8px; font-size: 12.5px; }
.oo-row .track { height: 8px; border-radius: 4px; background: var(--canvas); overflow: hidden; }
.oo-row .fill { height: 100%; border-radius: 4px; background: var(--faint); }
.fill.t-warn { background: var(--warn); } .fill.t-info { background: #0EA5E9; } .fill.t-ok { background: var(--ok); } .fill.t-out { background: var(--danger); } .fill.t-neutral { background: var(--faint); }
.oo-row b { text-align: end; }
.oo-list { border-top: 1px solid var(--border); padding-top: 8px; }
.oo-item { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: 13px; }
.oo-item b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-rows { display: flex; flex-direction: column; gap: 10px; }
.net-row { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.net-row .tile { width: 32px; height: 32px; border-radius: 10px; }
.net-row b { font-size: 15px; }
.net-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); font-weight: 600; }
.net-total b { font-size: 22px; }
.ops { display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; margin-inline: -4px; padding-inline: 4px; }
.op { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.op:last-child { border-bottom: 0; }
.op .tile { width: 36px; height: 36px; border-radius: 10px; }
.op-mid { min-width: 0; }
.op-mid b { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-mid small { color: var(--muted); font-size: 12px; }
.op-v { font-size: 15px; }

/* ---------- بانر ---------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 12px; border: 1px solid transparent; font-size: 13.5px; }
.banner > .ic { flex: none; }
.banner-txt { flex: 1; min-width: 0; line-height: 1.5; }
.banner .btn { flex: none; }
.b-warn { background: var(--warn-soft); color: var(--warn-text); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.b-info { background: color-mix(in srgb, #0E7490 8%, var(--surface)); color: #0B6A84; border-color: color-mix(in srgb, #0E7490 20%, transparent); }
:root[data-theme="dark"] .b-info { color: #7DD3FC; }
.b-ok { background: var(--ok-soft); color: var(--ok-text); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.b-danger { background: var(--danger-soft); color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.banner .btn-secondary { color: var(--text); }

/* ---------- جداول وقوايم ---------- */
.table-card { margin-bottom: 16px; }
.tbl-wrap { overflow-x: auto; }
.tbl-wrap table { min-width: 560px; }
thead th { position: static; }
th.n button, th.n { text-align: end; }
thead th button .ic.rot { transform: rotate(180deg); }
tbody td { vertical-align: middle; }
td small, .cell-prod small { display: block; }
.cell-prod { min-width: 0; }
.cell-prod b { white-space: nowrap; }
.tfoot b { color: var(--text); font-size: 14px; }
table.mini { min-width: 0; }
table.mini th, table.mini td { padding: 8px 10px; }
table.mini tr.sel td { background: var(--primary-soft); }
.list-card { padding: 4px 16px; }
.plist { margin-bottom: 16px; }
.pitem { flex-wrap: wrap; }
.pitem .avatar { flex: none; }
.pitem .end small { font-size: 11.5px; color: var(--muted); }
.pitem-acts { flex-basis: 100%; display: flex; justify-content: flex-end; border-top: 1px solid var(--border); margin: 6px -12px -4px; padding: 4px 8px 0; }
.ledger { display: flex; flex-direction: column; }
.ledger-row { display: grid; grid-template-columns: 36px 1fr auto auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row .tile { width: 36px; height: 36px; border-radius: 10px; }
.ledger-row b { font-weight: 600; font-size: 13.5px; }
.ledger-row small { display: block; color: var(--muted); font-size: 12px; }
.ledger-row > div { min-width: 0; }
.list-plain { display: flex; flex-direction: column; gap: 8px; }
.sum-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.sum-box div { background: var(--canvas); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.sum-box span { font-size: 12px; color: var(--muted); }

/* ---------- تخطيطات ---------- */
.split { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.split.even { grid-template-columns: 1fr 1fr; }
.split > .card:first-child.form-card { position: sticky; top: 0; }
.grid-2-1.rev { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); align-items: start; }
.card-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.card-head { flex-wrap: wrap; }
.form-acts { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.hint-card { display: flex; align-items: center; gap: 10px; color: var(--muted); }

/* ---------- نماذج ---------- */
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > label, .fld-lbl { font-size: 13px; font-weight: 600; color: var(--text-2); }
.req { color: var(--danger-text); font-style: normal; }
.hint { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.fld .field { height: 44px; }
.field input:disabled { color: var(--muted); }
.field.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
textarea { width: 100%; resize: vertical; min-height: 64px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: inherit; line-height: 1.6; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft), 0 0 0 3px var(--primary); }
textarea::placeholder { color: var(--muted); }
input[type=date], input[type=time], input[type=month], input[type=datetime-local] { min-width: 0; }
.tgl { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer; }
.tgl-txt { flex: 1; display: flex; flex-direction: column; }
.tgl-txt b { font-size: 13.5px; font-weight: 600; }
.tgl-txt small { font-size: 12px; color: var(--muted); }
.tgl input { position: absolute; opacity: 0; pointer-events: none; }
.tgl-ui { width: 42px; height: 24px; border-radius: 12px; background: var(--border); position: relative; flex: none; transition: background var(--t-fast); }
.tgl-ui::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: inset-inline-start var(--t-norm); }
.tgl input:checked + .tgl-ui { background: var(--primary-fill); box-shadow: inset 0 0 0 1px var(--primary-bright); }
.tgl input:checked + .tgl-ui::after { inset-inline-start: 21px; }
.tgl input:focus-visible + .tgl-ui { outline: 2px solid var(--primary); outline-offset: 2px; }
.tgl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.radios { display: flex; flex-wrap: wrap; gap: 8px; }
.radio input, .check input { position: absolute; opacity: 0; pointer-events: none; }
.radio span { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all var(--t-fast); }
.radio input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.radio input:focus-visible + span, .check input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.check span { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border); font-size: 13px; cursor: pointer; transition: all var(--t-fast); }
.check span::before { content: ""; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--faint); flex: none; transition: all var(--t-fast); }
.check input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.check input:checked + span::before { background: var(--primary-fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23101828' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5l10 -10'/%3E%3C/svg%3E") center/14px no-repeat; border-color: var(--primary); }
.shift-box, .tgl-box { display: flex; flex-direction: column; gap: 10px; }
.img-pick { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px dashed var(--border); border-radius: var(--r-md); }
.img-pick b { display: block; font-size: 13.5px; }
.img-pick small { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.img-pick.center { flex-direction: column; text-align: center; border: 0; padding: 0; }
.inline-add { display: flex; align-items: flex-end; gap: 8px; margin-top: 14px; }
.inline-add .fld { flex: 1; }
.inline-add .btn { height: 44px; }
.live-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; border-radius: var(--r-sm); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.live-total b { font-size: 20px; color: var(--text); }
.irows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.irow { display: grid; grid-template-columns: minmax(0, 1fr) 76px 104px 36px; gap: 8px; align-items: center; }
.irow .field { height: 42px; }
.form-card .card-head { margin-bottom: 12px; }

/* ---------- مودال / شيت ---------- */
.modal-host { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; }
.modal-bg { position: absolute; inset: 0; background: rgba(13, 15, 18, .48); opacity: 0; transition: opacity 200ms; }
.modal { position: relative; width: 100%; max-height: min(88vh, 860px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-modal); border: 1px solid var(--border); opacity: 0; transform: translateY(8px) scale(.98); transition: opacity 200ms, transform 220ms cubic-bezier(.16, 1, .3, 1); overflow: hidden; }
.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-sm { max-width: 440px; } .modal-md { max-width: 580px; } .modal-lg { max-width: 780px; }
.modal-host.open .modal-bg { opacity: 1; }
.modal-host.open .modal { opacity: 1; transform: none; }
.modal-host.closing .modal { opacity: 0; transform: translateY(8px) scale(.98); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.modal-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); }
.modal-ico.tone-danger { background: var(--danger-soft); color: var(--danger-text); }
.modal-title { flex: 1; min-width: 0; }
.modal-title h2 { font-size: 18px; font-weight: 700; line-height: 1.35; }
.modal-title p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 6px 20px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.modal .sheet-grip { display: none; }
.is-confirm .modal-head { flex-direction: column; text-align: center; padding-top: 24px; }
.is-confirm .modal-head .icon-btn { position: absolute; top: 12px; inset-inline-end: 12px; }
.is-confirm .modal-foot { justify-content: stretch; }
.is-confirm .modal-foot .btn { flex: 1; }
.confirm-msg { text-align: center; color: var(--text-2); line-height: 1.7; }
.modal.shake { animation: shake 360ms; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.menu-list { display: flex; flex-direction: column; gap: 4px; }
.menu-list button { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 12px; font-weight: 500; text-align: start; }
.menu-list button:hover { background: var(--canvas); }
.menu-list button.danger { color: var(--danger-text); }

/* ---------- الهيدر والشل ---------- */
.topbar-title { min-width: 0; }
.topbar-title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip { cursor: pointer; transition: border-color var(--t-fast); text-align: start; }
.user-chip:hover { border-color: var(--faint); }
.shift-chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding-inline: 12px; border-radius: var(--r-full); background: var(--ok-soft); color: var(--ok-text); font-size: 13px; font-weight: 700; }
.lang-tag { font: 700 13px "Google Sans", "IBM Plex Sans Arabic", sans-serif; }
.nav-item.danger { color: #FCA5A5; }
.nav-item.danger:hover { background: rgba(248, 113, 113, .14); color: #FECACA; }
.bn .pillbg { position: relative; }
.bn-dot { position: absolute; top: 3px; inset-inline-end: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.app.cashier .rail, .app.cashier .bottomnav, .app.cashier .tabs { display: none; }
.app.cashier .main { height: calc(100vh - 24px); height: calc(100dvh - 24px); }

/* ---------- الترحيب ---------- */
#welcome { position: fixed; inset: 0; overflow-y: auto; }
.welcome { min-height: 100%; display: grid; place-items: center; padding: 72px 16px 32px; position: relative; overflow: hidden; background: var(--canvas); }
.w-blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; pointer-events: none; }
.w-blob.b1 { width: 420px; height: 420px; background: #D9F99D; top: -120px; inset-inline-end: -80px; }
.w-blob.b2 { width: 360px; height: 360px; background: #ECFCCB; bottom: -120px; inset-inline-start: -60px; }
:root[data-theme="dark"] .w-blob { opacity: .14; }
.low-power .w-blob { display: none; }
.w-top { position: absolute; top: 16px; inset-inline-end: 16px; display: flex; gap: 8px; z-index: 2; }
.w-card { position: relative; z-index: 1; width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 30px; box-shadow: var(--shadow-float); padding: 36px 28px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.w-logo { width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; color: #101828; background: linear-gradient(135deg, #D9F99D, #A8E05A); box-shadow: 0 16px 32px -14px rgba(132, 204, 22, .7); }
.w-logo .ic { width: 36px; height: 36px; }
.w-card h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.w-tag { color: var(--muted); font-size: 14px; margin-top: -6px; }
.w-feats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px 0 10px; }
.w-feats span { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding-inline: 12px; border-radius: var(--r-full); background: var(--canvas); font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.w-card .btn-lg { margin-top: 4px; }
.w-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.w-row .btn { height: 48px; }
.w-hint { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---------- البحث الشامل ---------- */
.gs-field { height: 50px; }
.gs-results { display: flex; flex-direction: column; gap: 4px; min-height: 160px; }
.gs-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; text-align: start; }
.gs-item:hover, .gs-item:focus-visible { background: var(--canvas); }
.gs-item .tile { width: 36px; height: 36px; border-radius: 10px; }
.gs-txt { flex: 1; min-width: 0; }
.gs-txt b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-txt small { color: var(--muted); font-size: 12px; }

/* ---------- POS إضافات ---------- */
.team-alert { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn-text); font-size: 13px; flex: none; }
.team-alert span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.pos-stats { display: grid; grid-template-columns: repeat(3, 1fr) 96px; gap: 8px; flex: none; }
.pos-stats > div { display: flex; flex-direction: column; padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.pos-stats span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.pos-stats b { font-size: 15px; white-space: nowrap; }
.pos-mini { flex-direction: row !important; align-items: flex-end; gap: 4px; }
.pos-mini i { flex: 1; border-radius: 3px 3px 1px 1px; background: var(--primary-soft); min-height: 4px; }
:root[data-theme="dark"] .pos-mini i { background: rgba(196, 242, 121, .22); }
.pos-mini i.on { background: var(--primary-bright); }
.cart-who { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 20px 0; }
.cart-who .field { height: 40px; padding-inline: 10px; gap: 6px; }
.cart-who select, .cart-who input { font-size: 13px; }
.sum-rows .profit { color: var(--ok-text); font-weight: 600; }
.scanner { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 0; color: var(--muted); }
.scan-frame { width: 100%; max-width: 300px; aspect-ratio: 4 / 3; border-radius: 20px; background: #0D0F12; position: relative; overflow: hidden; }
.scan-frame::before { content: ""; position: absolute; inset: 22%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 12px; }
.scan-frame i { position: absolute; inset-inline: 22%; top: 50%; height: 2px; background: #C4F279; box-shadow: 0 0 12px #C4F279; animation: scan 1.6s ease-in-out infinite alternate; }
@keyframes scan { from { top: 26%; } to { top: 74%; } }
.held-row { display: grid; grid-template-columns: 36px 1fr auto auto auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 14px; }
.held-row .tile { width: 36px; height: 36px; border-radius: 10px; }
.held-mid { min-width: 0; }
.held-mid b { display: block; font-size: 14px; }
.held-mid small { color: var(--muted); font-size: 12px; }

/* ---------- الطلبات الأونلاين ---------- */
.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.order { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-inline-start: 4px solid var(--border); }
.order.pending { border-inline-start-color: var(--faint); } .order.preparing { border-inline-start-color: var(--warn); } .order.delivering { border-inline-start-color: #0EA5E9; }
.order.delivered { border-inline-start-color: var(--ok); } .order.cancelled { border-inline-start-color: var(--danger); opacity: .8; }
.order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.order-head b { display: block; font-size: 14.5px; }
.order-head small { color: var(--muted); font-size: 12px; }
.order-meta { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.order-meta span { display: flex; align-items: center; gap: 6px; }
.order-items { list-style: none; margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--canvas); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.order-items li { display: flex; justify-content: space-between; gap: 8px; }
.order-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.order-total small { display: block; font-size: 11.5px; color: var(--muted); }
.order-total b { font-size: 18px; }
.order-foot .acts { gap: 4px; flex-wrap: wrap; }

/* ---------- التوصيل ---------- */
.courier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.courier { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); }
.courier-mid { flex: 1; min-width: 0; }
.courier-mid b { display: block; }
.courier-mid small { color: var(--muted); font-size: 12px; }
.courier-counts { display: flex; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- الملاحظات ---------- */
.seg-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 16px; }
.seg-tab { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); text-align: start; transition: all var(--t-fast); }
.seg-tab .tile { width: 40px; height: 40px; }
.seg-tab b { display: block; font-size: 14px; }
.seg-tab b small { font-weight: 700; color: var(--muted); margin-inline-start: 4px; }
.seg-tab small { display: block; font-size: 12px; color: var(--muted); }
.seg-tab[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.seg-tab[aria-pressed="true"] .tile { background: var(--primary-fill); color: var(--on-primary); }
.notes-list { display: flex; flex-direction: column; gap: 10px; }
.note { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.note.pinned { border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.note-head { display: flex; align-items: center; gap: 8px; }
.note-head b { font-size: 13.5px; }
.note-time { margin-inline-start: auto; font-size: 11.5px; color: var(--muted); }
.note p { margin: 8px 0; line-height: 1.7; }
.note-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.todo { display: flex; flex-direction: column; }
.todo-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.todo-row:last-child { border-bottom: 0; }
.todo-row .tile { width: 36px; height: 36px; border-radius: 10px; }
.todo-check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--faint); display: grid; place-items: center; flex: none; color: #fff; }
.todo-check[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); }
.todo-txt { flex: 1; min-width: 0; }
.todo-txt b { display: block; font-weight: 600; font-size: 13.5px; }
.todo-txt small { color: var(--muted); font-size: 12px; }
.todo-row.done .todo-txt b { text-decoration: line-through; color: var(--muted); }

/* ---------- الإشعارات / النشاط ---------- */
.nrow { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.nrow:last-child { border-bottom: 0; }
.nrow.unread { position: relative; }
.nrow.unread::before { content: ""; position: absolute; inset-inline-start: -12px; top: 50%; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); translate: 0 -50%; }
.nrow-mid { min-width: 0; }
.nrow-mid b { display: block; font-size: 14px; }
.nrow-mid small { display: block; color: var(--text-2); font-size: 12.5px; }
.nrow-meta { font-size: 11.5px; color: var(--muted); }
.nrow-end { display: flex; align-items: center; gap: 4px; }
.timeline { display: flex; flex-direction: column; }
.tl-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tl-row:last-child { border-bottom: 0; }
.tl-row .tile { width: 36px; height: 36px; border-radius: 10px; }
.tl-mid { min-width: 0; }
.tl-mid b { display: block; font-size: 13.5px; }
.tl-mid small { color: var(--muted); font-size: 12.5px; }
.tl-end { text-align: end; font-size: 12.5px; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.tl-end span { display: inline-flex; align-items: center; gap: 6px; }
.tl-end small { color: var(--muted); }

/* ---------- المخزون والمنتجات ---------- */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 28px 16px; border: 2px dashed var(--border); border-radius: var(--r-md); color: var(--muted); }
.dropzone b { color: var(--text); }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding-inline: 12px 4px; border-radius: var(--r-full); background: var(--tint-bg); color: var(--tint-fg); font-weight: 600; font-size: 13px; }
.cat-chip small { opacity: .75; }
.cat-chip button { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: inherit; }
.cat-chip button:hover { background: rgba(0, 0, 0, .08); }
.count-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.count-row { display: grid; grid-template-columns: 32px 1fr auto 96px; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.count-row .tile { width: 32px; height: 32px; border-radius: 10px; }
.count-row b { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count-row small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.count-row .field { height: 38px; }

/* ---------- الفريق ---------- */
.clock-panel { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.clock-now { display: flex; flex-direction: column; padding: 8px 16px; border-radius: var(--r-sm); background: var(--canvas); }
.clock-now b { font-size: 22px; }
.clock-now span { font-size: 12px; color: var(--muted); }
.clock-panel .field { height: 44px; }
.clock-panel .btn { height: 44px; }
.present-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.pchip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding-inline: 4px 12px; border-radius: var(--r-full); background: var(--ok-soft); color: var(--ok-text); font-size: 12.5px; font-weight: 600; }
.pchip small { opacity: .8; }
.emp-list { display: flex; flex-direction: column; }
.emp-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.emp-row:last-child { border-bottom: 0; }
.emp-mid { flex: 1; min-width: 140px; }
.emp-mid b { display: block; }
.emp-mid small { color: var(--muted); font-size: 12px; }
.emp-due { display: flex; flex-direction: column; align-items: flex-end; min-width: 110px; }
.emp-due small { font-size: 11.5px; color: var(--muted); }
.emp-due b { font-size: 16px; }
.breakdown { display: flex; flex-direction: column; }
.bd-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.bd-row small { display: block; font-size: 11.5px; color: var(--muted); }
.bd-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--primary-soft); font-weight: 600; }
.bd-total b { font-size: 20px; }
.comm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.comm-cell { display: grid; grid-template-columns: 32px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.comm-cell .tile { width: 32px; height: 32px; border-radius: 10px; grid-row: span 2; }
.comm-cell span:not(.tile) { font-size: 12px; color: var(--muted); }
.comm-cell b { font-size: 15px; }
.meal-list { display: flex; flex-direction: column; gap: 8px; }
.meal-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 140px 64px; gap: 6px; align-items: center; }
.meal-row b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meal-row .field { height: 38px; padding-inline: 8px; }
.meal-row select { font-size: 12.5px; }
.emp-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 16px; }
.emp-hero b { display: block; font-size: 18px; }
.emp-hero small { color: var(--muted); }
.att-day { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 8px 0; }
.att-day div { display: flex; flex-direction: column; }
.att-day small { font-size: 11.5px; color: var(--muted); }

/* ---------- التقارير ---------- */
.report-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.report-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.quick-range { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.quick-range .chip { height: 34px; }
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; }
.rank li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.medal { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--canvas); color: var(--text-2); flex: none; }
.medal.m1 { background: linear-gradient(135deg, #FCD34D, #D97706); color: #fff; }
.medal.m2 { background: linear-gradient(135deg, #E5E7EB, #9CA3AF); color: #fff; }
.medal.m3 { background: linear-gradient(135deg, #FDBA74, #B45309); color: #fff; }

/* ---------- الإعدادات ---------- */
.settings { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.set-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.set-link { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 10px; font-size: 13.5px; font-weight: 500; color: var(--text-2); text-align: start; }
.set-link:hover { background: var(--canvas); }
.set-link[aria-current="true"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.set-link.danger { color: var(--danger-text); }
.set-body { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.set-title { display: flex; align-items: center; gap: 12px; }
.set-title h2 { font-size: 20px; font-weight: 700; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding-inline: 8px 14px; border-radius: var(--r-full); border: 1px solid var(--border); font-size: 13px; font-weight: 600; cursor: pointer; }
.swatch i { width: 24px; height: 24px; border-radius: 50%; background: var(--sw); }
.swatch input:checked + span { border-color: var(--sw); box-shadow: inset 0 0 0 1px var(--sw); }
.swatch input:focus-visible + span { outline: 2px solid var(--sw); outline-offset: 2px; }
.folder-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.folder { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px; height: 40px; padding-inline: 12px; border-radius: 10px; background: var(--canvas); font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; direction: ltr; justify-content: flex-end; }
.nav-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.nav-edit-row { display: flex; align-items: center; gap: 8px; }
.nav-edit-row .check span { padding: 0; border: 0; min-height: 0; }
.nav-edit-row .check span::before { margin: 0; }
.nav-edit-row .field { flex: 1; height: 40px; }
.danger-card { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

/* ==========================================================================
   Responsive للمكوّنات
   ========================================================================== */
@media (max-width: 1280px) {
  .grid-2-1.rev { grid-template-columns: 1fr; }
}
@media (max-width: 1099px) {
  .split, .split.even { grid-template-columns: 1fr; }
  .split > .card:first-child.form-card { position: static; }
  .settings { grid-template-columns: 1fr; }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; padding: 6px; }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-link { white-space: nowrap; flex: none; }
}
@media (max-width: 999px) {
  .pos-stats { display: none; }
}
@media (max-width: 699px) {
  .hide-phone { display: none !important; }
  .table-card.has-cards { display: none; }
  .tbl-wrap table { min-width: 520px; }
  .pagebar { flex-direction: column; align-items: stretch; }
  .pagebar-start, .pagebar-end { width: 100%; }
  .pagebar-start .field, .pagebar .w-220, .pagebar .w-260, .pagebar .w-180 { width: 100%; flex: 1 1 100%; }
  .pagebar-end .btn { flex: 1; }
  .btn-group { width: 100%; }
  .btn-group .btn { flex: 1 1 auto; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 12px; gap: 10px; }
  .stat-ico { width: 34px; height: 34px; border-radius: 10px; }
  .stat-val { font-size: 17px; }
  .report-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi svg.spark { width: calc(100% + 32px); margin-inline: -16px; }
  .shift-chip { display: none; }
  .tools .circle-btn { width: 42px; height: 42px; }
  .order-grid { grid-template-columns: 1fr; }
  .irow { grid-template-columns: 1fr 64px 84px 36px; gap: 6px; }
  .meal-row { grid-template-columns: 1fr 72px; }
  .meal-row .field.sel { grid-column: 1; }
  .count-row { grid-template-columns: 32px 1fr 80px; }
  .count-row small { display: none; }
  .ledger-row { grid-template-columns: 36px 1fr auto; }
  .held-row { grid-template-columns: 36px 1fr auto; }
  .held-row .btn, .held-row .icon-btn { grid-row: 2; }
  .cart-who { grid-template-columns: 1fr; padding: 10px 16px 0; }
  .w-row { grid-template-columns: 1fr; }
  .w-card { padding: 28px 20px 20px; border-radius: 26px; }
  .sum-box { grid-template-columns: 1fr; }
  /* المودال يبقى bottom sheet */
  .modal-host { padding: 0; place-items: end stretch; }
  .modal { max-width: none !important; border-radius: 28px 28px 0 0; max-height: 92vh; max-height: 92dvh; border-bottom: 0; transform: translateY(40px); }
  .modal-host.open .modal { transform: none; }
  .modal-host.closing .modal { transform: translateY(40px); }
  .modal .sheet-grip { display: block; position: static; padding: 10px 0 0; }
  .modal .sheet-grip .g { margin-bottom: 0; }
  .modal-head { padding-top: 10px; }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .fgrid { grid-template-columns: 1fr; }
  .checks { grid-template-columns: 1fr 1fr; }
  .nrow { grid-template-columns: 36px 1fr; }
  .nrow-end { grid-column: 1 / -1; justify-content: flex-end; }
}

/* إصلاحات الفحص الآلي */
.pagebar-start > .chips { flex: 1 1 0; min-width: 0; max-width: 100%; }
.pagebar-end { flex: none; }
.report-cards .stat { align-items: flex-start; }
.report-cards .stat-sub, .report-cards .stat-lbl { white-space: normal; }

/* ---------- الصور الحقيقية (Unsplash) — الأيقونة تفضل تحت الصورة كـ fallback ---------- */
.tile, .avatar { position: relative; }
.ptile img, .avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; background: var(--surface-2); }
.ptile.sm { width: 32px; height: 32px; border-radius: 10px; }
.ptile.lg { width: 56px; height: 56px; border-radius: 16px; }
.avatar { overflow: visible; }
.pcard .ptile { box-shadow: inset 0 0 0 1px var(--border); }
.pcard .ptile img { z-index: 0; }
.pcard .qty { z-index: 1; }
.welcome .w-photo { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .16; filter: saturate(.9); pointer-events: none; }
:root[data-theme="dark"] .welcome .w-photo { opacity: .12; }
.low-power .welcome .w-photo { display: none; }
.sizes { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.sizes .ic { width: 14px; height: 14px; color: var(--muted); }
.smart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.smart { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); }
.smart > div { flex: 1; min-width: 0; }
.smart b { display: block; font-size: 13.5px; }
.smart small { color: var(--muted); font-size: 12px; }
.smart.s-warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.smart.s-danger { border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.disc-box { display: inline-flex; align-items: center; gap: 6px; }
.disc-box .field { width: 84px; height: 30px; padding-inline: 8px; }
.disc-box .field input { font-size: 13px; text-align: center; }
@media (pointer: coarse) { .disc-box .field { height: 36px; } }
.store-line { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.store-line b { color: var(--text-2); font-weight: 600; }
.store-line span { white-space: nowrap; }
.rail-user { display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 4px; border-radius: 16px; background: rgba(255, 255, 255, .06); color: #fff; text-align: start; width: 100%; }
.rail-user:hover { background: rgba(255, 255, 255, .1); }
.rail-user b { display: block; font-size: 13px; line-height: 1.3; }
.rail-user small { display: block; font-size: 11px; color: var(--rail-text); }
.rail.collapsed .rail-user, .rail-user:only-child { justify-content: center; }
@media (max-width: 1099px) { .rail-user { justify-content: center; padding: 6px 0; background: none; } }
@media (max-width: 699px) { .store-line { display: none; } }
.ng-card { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.ng-card.pinned { flex-direction: row; align-items: center; gap: 8px; border-style: dashed; }
.ng-head { display: flex; align-items: center; gap: 8px; }
.ng-head .field { height: 40px; font-weight: 600; }
.ng-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(140px, 200px); gap: 8px; align-items: center; }
.ng-row .field { height: 38px; }
.ng-row.off .field:first-of-type input { text-decoration: line-through; color: var(--muted); }
.ng-row .check span { padding: 0; border: 0; min-height: 0; }
.ng-empty { font-size: 12.5px; padding: 6px 2px; }
@media (max-width: 699px) { .ng-row { grid-template-columns: 28px 1fr; } .ng-row .field.sel { grid-column: 2; } }

/* ---------- القائمة الجانبية الكاملة (كل الأقسام تحت عناوين المجموعات) ---------- */
.rail-nav { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; margin-inline: -4px; padding-inline: 4px; }
.nav-group { display: flex; flex-direction: column; }
.nav-group + .nav-group { margin-top: 6px; }
.nav-group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 30px; padding-inline: 12px 10px; border-radius: 10px; color: rgba(255, 255, 255, .45); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; text-align: start; }
.nav-group-head:hover { color: rgba(255, 255, 255, .8); background: rgba(255, 255, 255, .05); }
.nav-group-head .ic { transition: transform var(--t-fast); }
.nav-group.closed .nav-group-head .ic { transform: rotate(90deg); }
[dir="ltr"] .nav-group.closed .nav-group-head .ic { transform: rotate(-90deg); }
.nav-group-items { display: flex; flex-direction: column; gap: 2px; }
.nav-group.closed .nav-group-items { display: none; }
.nav-item.sub { height: 38px; font-size: 13.5px; border-radius: 12px; gap: 10px; }
.nav-item.sub .ic { width: 18px; height: 18px; }
.nav-item.sub .badge-dot { min-width: 18px; height: 18px; font-size: 10.5px; }
.rail-full .rail { width: 248px; }
.rail-full .rail-foot .nav-item { height: 38px; font-size: 13.5px; }
@media (max-height: 760px) { .nav-item.sub { height: 34px; } .nav-group-head { height: 26px; } }

/* ---------- درج «كل الأقسام» (فون/تابلت/شريط مطوي) ---------- */
.nav-drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 60;
  width: min(320px, 86vw); display: flex; flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background: var(--rail); color: var(--rail-text);
  border-start-end-radius: 24px; border-end-end-radius: 24px;
  box-shadow: var(--shadow-modal); visibility: hidden;
  transform: translateX(105%); transition: transform 280ms cubic-bezier(.16, 1, .3, 1), visibility 0s 280ms;
}
[dir="ltr"] .nav-drawer { transform: translateX(-105%); }
.nav-drawer.open { transform: none; visibility: visible; transition: transform 280ms cubic-bezier(.16, 1, .3, 1); }
.nd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 14px; }
.nd-nav { flex: 1; min-height: 0; overflow-y: auto; }
.nd-foot { display: flex; flex-direction: column; gap: 2px; }
.nd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.nav-drawer .nav-item.sub { height: 44px; font-size: 14.5px; }
.nav-drawer .nav-item.danger { color: #FCA5A5; }
.nav-drawer .nav-label { display: inline !important; }
.rail-menu { display: none; }
.rail.collapsed .rail-menu { display: grid; }
.rail-full .menu-btn, .rail-full .rail-menu { display: none !important; }
@media (max-width: 1099px) { .rail .rail-menu { display: grid !important; } }
@media (max-width: 699px) { .tools .menu-btn { order: -1; } }
@media (max-width: 699px) { .tbl-wrap table.mini { min-width: 520px; } .tbl-wrap table.mini td, .tbl-wrap table.mini th { white-space: nowrap; } }

/* ---------- شيت «المزيد» على الفون: كل الأقسام (فاتح، من تحت) ---------- */
.more-sheet { max-height: 86vh; max-height: 86dvh; display: flex; flex-direction: column; }
.more-sheet .grip { flex: none; }
.more-grid { display: flex !important; flex-direction: column; gap: 16px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding-bottom: 4px; }
.more-group h4 { margin: 0 4px 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.more-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.more-tiles button { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; padding: 10px 4px; min-height: 84px; border-radius: var(--r-md); background: var(--canvas); font-size: 12px; font-weight: 500; line-height: 1.35; text-align: center; color: var(--text); }
.more-tiles button .tile { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); color: var(--text-2); position: relative; }
.more-tiles button[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; box-shadow: inset 0 0 0 1px var(--primary-bright); }
.more-tiles button[aria-current="page"] .tile { background: var(--primary-fill); color: var(--on-primary); }
.tile-badge { position: absolute; top: -5px; inset-inline-end: -5px; min-width: 18px; height: 18px; padding-inline: 5px; border-radius: 9px; background: var(--danger); color: #fff; font: 700 10.5px/18px "Google Sans", sans-serif; font-style: normal; text-align: center; border: 2px solid var(--canvas); }
@media (max-width: 359px) { .more-tiles { grid-template-columns: repeat(3, 1fr); } }
.scan-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner p { text-align: center; }
