/* MAASARA — معصرة الزيتون. نظام التصميم الوحيد للواجهة (الطباعة في print.css ولا تتأثر).
   لا اعتماديات خارجية: كل الخطوط محلية ليعمل البرنامج دون إنترنت. */

@font-face { font-family: 'Inter'; src: url('../fonts/Inter-400.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-500.woff2') format('woff2'); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-600.woff2') format('woff2'); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-700.woff2') format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('../fonts/PlexArabic-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('../fonts/PlexArabic-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('../fonts/PlexArabic-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('../fonts/PlexArabic-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'EB Garamond'; src: url('../fonts/EBGaramond-500.woff2') format('woff2'); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'EB Garamond'; src: url('../fonts/EBGaramond-600.woff2') format('woff2'); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Amiri'; src: url('../fonts/Amiri-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Amiri'; src: url('../fonts/Amiri-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
    --navy-950: #0B1628; --navy-900: #0E1B33; --navy-800: #14284B; --navy-700: #1C3561; --navy-600: #2C4A7C; --navy-100: #DCE3EF; --navy-50: #EEF2F8;
    --emerald-800: #085A42; --emerald-700: #0B6B4F; --emerald-100: #CDE8DD; --emerald-50: #E8F4EF;
    --gold-700: #8A6A2F; --gold-500: #B8955A; --gold-100: #F3EADA;
    --ivory: #FAF7F0; --ivory-2: #F4EFE4;
    --stone-300: #CFC7B6; --stone-200: #E4DED1;
    --ink-900: #1A2233; --ink-600: #5B6474;

    --primary: var(--navy-800); --primary-hover: var(--navy-900);
    --bg-main: var(--ivory); --bg-card: #FFFFFF; --bg-subtle: var(--ivory-2);
    --text-main: var(--ink-900); --text-muted: var(--ink-600);
    --border-color: var(--stone-200); --border-strong: var(--stone-300); --border-hover: #B9B09D;
    --focus-ring: 0 0 0 3px rgba(44,74,124,.35);

    --success: var(--emerald-700); --success-bg: var(--emerald-50); --success-border: var(--emerald-100);
    --warning: #9A4B06; --warning-bg: #FDF4E7; --warning-border: #F2D7AE;
    --danger: #A8261B; --danger-hover: #8C1F16; --danger-bg: #FCEFEE; --danger-border: #F2C9C5;
    --neutral-bg: #F1EEE7; --neutral-text: #4B5363; --row-hover: #FCFAF5;
    --side-text: #B7C2D6;

    --shadow-sm: 0 1px 2px 0 rgba(20,40,75,.05);
    --shadow-md: 0 2px 6px -1px rgba(20,40,75,.08), 0 1px 3px -1px rgba(20,40,75,.05);
    --shadow-lg: 0 12px 28px -8px rgba(20,40,75,.18);
    --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px;
    --dur-fast: 120ms; --dur-base: 180ms;
    --font-ui: 'Inter', 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-display: 'EB Garamond', 'Amiri', Georgia, serif;
    --side-w: 256px; --touch: 44px;
}
@media (pointer: coarse) { :root { --touch: 48px; } }

/* ---------- الأساس ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 16px; }
body { margin: 0; font-family: var(--font-ui); background: var(--bg-main); color: var(--text-main); line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.65rem; margin: 0; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 0 0 1rem; color: var(--navy-900); }
h3 { font-size: 1rem; font-weight: 600; color: var(--navy-900); }
a { color: var(--navy-600); }
:focus-visible { outline: 2px solid var(--navy-600); outline-offset: 2px; }
.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }
.text-end { text-align: end; }
.small { font-size: .85rem; }
.required, .neg, .late { color: var(--danger); }
.required { font-weight: 700; }
td.pos, span.pos, strong.pos, b.pos { color: var(--success); }
.pad { padding: 1rem 1rem 0; }
.inline { display: inline-flex; gap: .3rem; align-items: center; }
.is-off { opacity: .5; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* ---------- الهيكل: شريط جانبي + شريط علوي ---------- */
.sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 40; width: var(--side-w); display: flex; flex-direction: column;
    background: var(--navy-900); color: var(--side-text); transition: width var(--dur-base), transform var(--dur-base);
}
.app-shell { margin-inline-start: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; transition: margin var(--dur-base); }
body.login-page .app-shell { margin: 0; }
.side-brand { display: flex; align-items: center; gap: .6rem; min-height: 64px; padding: .6rem .9rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
.logo-mark { width: 38px; height: 38px; flex: none; }
.brand-logo { height: 38px; width: 38px; object-fit: contain; border-radius: var(--radius-sm); background: #fff; flex: none; }
.side-brand-text { display: grid; line-height: 1.2; min-width: 0; }
.side-brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; letter-spacing: .08em; direction: ltr; text-align: start; }
.side-brand-sub { font-size: .75rem; color: var(--gold-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-nav { flex: 1; overflow-y: auto; padding: .6rem .6rem 1rem; }
.side-group { font-size: .7rem; font-weight: 600; color: rgba(183,194,214,.65); padding: .9rem .6rem .3rem; }
.side-link {
    position: relative; display: flex; align-items: center; gap: .6rem; min-height: 38px; padding: 0 .6rem; border-radius: 7px; margin-bottom: 2px;
    color: var(--side-text); text-decoration: none; font-size: .83rem; font-weight: 500; white-space: nowrap; background: none; border: 0; width: 100%; font-family: inherit; cursor: pointer;
    transition: background var(--dur-fast), color var(--dur-fast);
}
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-link.is-active { background: rgba(255,255,255,.08); color: #fff; }
.side-link.is-active::before { content: ''; position: absolute; inset-block: 7px; inset-inline-start: -.6rem; width: 3px; border-radius: 0 2px 2px 0; background: var(--gold-500); }
.side-link .icon { width: 16px; height: 16px; }
.side-link:focus-visible, .side-brand:focus-visible { outline-color: #fff; }
.side-user { display: flex; align-items: center; gap: .55rem; padding: .7rem .8rem; border-top: 1px solid rgba(255,255,255,.08); }
.side-user form { margin: 0; margin-inline-start: auto; }
.side-user-text { display: grid; line-height: 1.25; min-width: 0; font-size: .8rem; color: #fff; }
.side-user-text small { color: var(--side-text); font-size: .72rem; }
.side-user-text span, .side-user-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--navy-700); color: #fff; font-weight: 600; font-size: .85rem; }
.side-out { width: 32px; height: 32px; display: grid; place-items: center; background: none; border: 0; border-radius: var(--radius-sm); color: var(--side-text); cursor: pointer; }
.side-out:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-backdrop { display: none; }

html.sb-collapsed { --side-w: 68px; }
html.sb-collapsed .side-brand { justify-content: center; padding-inline: 0; }
html.sb-collapsed .side-brand-text, html.sb-collapsed .side-link span, html.sb-collapsed .side-group, html.sb-collapsed .side-user-text, html.sb-collapsed .side-user form { display: none; }
html.sb-collapsed .side-link { justify-content: center; padding: 0; }
html.sb-collapsed .side-user { justify-content: center; }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .7rem; height: 56px; padding: 0 1.1rem; background: var(--bg-card); border-bottom: 1px solid var(--border-color); }
.crumbs { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--text-muted); min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--navy-800); }
.crumbs b { color: var(--navy-900); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.topbar-info { display: flex; align-items: center; gap: .7rem; margin-inline-start: auto; flex: none; }
.topbar-info form { margin: 0; display: flex; }
.pill-clock { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--text-muted); }
.clock { font-variant-numeric: tabular-nums; font-weight: 500; direction: ltr; }
.user-chip { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 500; }
.icon-btn { width: 38px; height: 38px; flex: none; border-radius: var(--radius-md); display: inline-grid; place-items: center; border: 1px solid var(--border-color); background: var(--bg-card); color: var(--navy-800); cursor: pointer; transition: background var(--dur-fast); }
.icon-btn:hover { background: var(--navy-50); }
.side-open { display: none; }

.container { width: 100%; max-width: 1480px; margin: 0 auto; padding: 1.4rem; flex: 1; }
.page-head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head h1 { flex: 1; min-width: 12rem; font-family: var(--font-display); font-weight: 600; color: var(--navy-900); line-height: 1.25; }
.page-head h1::after { content: ''; display: block; width: 36px; height: 2px; background: var(--gold-500); margin-top: .35rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- البطاقات والأزرار والحقول ---------- */
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 1.5rem; margin-bottom: 1rem; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: var(--touch); padding: .35rem 1.05rem; border-radius: var(--radius-md); border: 1px solid transparent;
    font: inherit; font-size: .95rem; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none; user-select: none; transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--emerald-700); color: #fff; }
.btn-success:hover { background: var(--emerald-800); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-secondary, .btn-ghost { background: var(--bg-card); color: var(--navy-800); border-color: var(--border-strong); }
.btn-secondary:hover, .btn-ghost:hover { background: var(--navy-50); }
.btn-sm { min-height: 36px; padding: .15rem .7rem; font-size: .85rem; }
.btn-lg { min-height: 52px; padding: .45rem 1.5rem; font-size: 1.05rem; }
.btn-xl { min-height: 60px; font-size: 1.2rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled, form.is-busy .btn { opacity: .5; pointer-events: none; }

.field { display: flex; flex-direction: column; gap: .3rem; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--text-main); }
.field small { font-weight: 400; }
input:not([type=checkbox]):not([type=hidden]):not([type=radio]), select, textarea {
    min-height: max(42px, var(--touch)); padding: .35rem .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
    font: inherit; font-size: 1rem; background: var(--bg-card); color: var(--text-main); width: 100%; transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
input:hover:not(:focus):not(:disabled), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: var(--border-hover); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy-600); box-shadow: var(--focus-ring); }
input[readonly] { background: var(--bg-subtle); }
input[type=color] { padding: .2rem; }
input[type=checkbox], input[type=radio] { accent-color: var(--navy-800); }
.check { display: flex; align-items: center; gap: .6rem; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; }
.check.is-disabled { opacity: .5; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.field-wide { grid-column: 1 / -1; }
.form-actions { margin-top: 1.2rem; display: flex; gap: .6rem; }
.form-inline { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; }
.form-inline .field { min-width: 180px; }
.table .form-inline { align-items: center; gap: .4rem; }
.table .form-inline input { min-height: 40px; width: auto; }
.lookup-input { width: 150px !important; min-height: 36px !important; display: inline-block; }

/* ---------- التنبيهات والشارات ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid; margin-bottom: 1rem; font-weight: 500; }
.alert ul { margin: 0; padding-inline-start: 1.2rem; }
.alert-success { background: var(--success-bg); color: var(--emerald-800); border-color: var(--success-border); }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.badge { display: inline-block; padding: .1rem .6rem; border-radius: var(--radius-sm); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge-success { background: var(--emerald-50); color: var(--emerald-800); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: var(--neutral-bg); color: var(--neutral-text); }
.badge-info { background: var(--navy-50); color: var(--navy-800); }
.badge-gold { background: var(--gold-100); color: var(--gold-700); }

/* ---------- الجداول ---------- */
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th, .table td { padding: .6rem .85rem; border-bottom: 1px solid var(--border-color); text-align: start; vertical-align: middle; font-variant-numeric: tabular-nums; }
.table th { background: var(--bg-subtle); font-size: .78rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.table tbody tr:hover { background: var(--row-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table-compact td { font-size: .82rem; padding: .4rem .6rem; }
code.json { font-size: .78rem; direction: ltr; display: block; max-width: 260px; overflow-wrap: anywhere; color: var(--text-muted); }
.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }
.row-cancelled td { color: var(--text-muted); text-decoration: line-through; }
.row-cancelled td:last-child { text-decoration: none; }
.summary-table th { width: 55%; color: var(--text-main); background: transparent; font-size: .9rem; font-weight: 500; white-space: normal; }
.summary-table .row-strong th, .summary-table .row-strong td { font-weight: 700; font-size: 1rem; background: var(--bg-subtle); }

/* ---------- عناصر عامة ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.2rem; margin: 0; }
.details dt { color: var(--text-muted); font-weight: 500; }
.details dd { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { position: relative; display: flex; flex-direction: column; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: .9rem 1.1rem; }
.stat span { color: var(--text-muted); font-size: .85rem; }
.stat strong { font-size: 1.45rem; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats-3 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.stat small { color: var(--text-muted); }
.stat-danger strong { color: var(--danger); }
.stat-big strong { font-size: 1.9rem; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-top: 1rem; }
.perm-group { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: .6rem 1rem; }
.perm-group legend { font-weight: 600; padding: 0 .4rem; }
.restore-box summary { list-style: none; display: inline-flex; } .restore-box[open] { display: block; margin-top: .4rem; }
.logo-preview { max-height: 90px; width: auto; }

/* ---------- الصفحة الرئيسية ---------- */
.home-hero { margin-bottom: 1rem; }
.home-hero h1 { font-family: var(--font-display); font-weight: 600; color: var(--navy-900); }
.home-hero h1::after { content: ''; display: block; width: 36px; height: 2px; background: var(--gold-500); margin-top: .35rem; }
.home-hero p { margin: .3rem 0 0; color: var(--text-muted); font-size: .9rem; }
.home-status { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; min-height: 124px; padding: 1rem; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--text-main); text-align: center; transition: border-color var(--dur-fast), background var(--dur-fast); }
a.tile:hover { border-color: var(--border-hover); background: var(--row-hover); }
.tile-icon { width: 46px; height: 46px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--navy-50); color: var(--navy-800); }
.tile-icon .icon { width: 24px; height: 24px; }
.tile-label { font-weight: 600; font-size: .95rem; }
.tile-disabled { opacity: .5; cursor: not-allowed; }
.tile-note { font-size: .8rem; color: var(--text-muted); }

/* ---------- لوحة التحكم ---------- */
.dash-hero { position: relative; overflow: hidden; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .4rem 0 1rem; margin-bottom: .6rem; }
.dash-hero h1 { font-family: var(--font-display); font-weight: 600; color: var(--navy-900); font-size: 1.9rem; }
.dash-hero h1::after { content: ''; display: block; width: 36px; height: 2px; background: var(--gold-500); margin-top: .35rem; }
.dash-hero p { margin: .35rem 0 0; color: var(--text-muted); font-size: .9rem; }
.dash-branch { position: absolute; inset-inline-end: 9rem; top: -14px; width: 210px; height: 96px; color: var(--emerald-700); opacity: .22; pointer-events: none; }
.dash-hero-actions { position: relative; }
.stat-has-icon { padding-inline-end: 3.6rem; }
.stat-icon { position: absolute; top: .9rem; inset-inline-end: .9rem; width: 38px; height: 38px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--navy-50); color: var(--navy-800); }
.stat-icon .icon { width: 20px; height: 20px; }
.stat-emerald .stat-icon { background: var(--emerald-50); color: var(--emerald-700); }
.stat-gold .stat-icon { background: var(--gold-100); color: var(--gold-700); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; margin-bottom: 1rem; }
.dash-grid > .card { margin: 0; }
.dash-card-wide { grid-column: 1 / -1; }
.prod-bars { display: grid; gap: .7rem; margin: 0; }
.prod-bar { display: grid; grid-template-columns: minmax(70px, auto) minmax(0, 1fr) minmax(70px, auto); align-items: center; gap: .7rem; font-size: .875rem; }
.prod-track { height: 12px; }
.prod-fill { display: block; height: 100%; min-width: 2px; background: var(--emerald-700); border-start-end-radius: 4px; border-end-end-radius: 4px; }
.prod-value { font-variant-numeric: tabular-nums; font-weight: 600; text-align: end; }
.ticket-code { font-weight: 700; font-size: 1rem; color: var(--navy-900); text-decoration: none; direction: ltr; display: inline-block; }
.box-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .85rem; color: var(--text-muted); margin-bottom: .8rem; }
.box-legend b { color: var(--text-main); font-variant-numeric: tabular-nums; }
.box-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 4px; max-height: 340px; overflow-y: auto; }
.box-tile { display: grid; place-items: center; align-content: center; min-height: 44px; border-radius: var(--radius-sm); border: 1px solid var(--emerald-100); background: var(--emerald-50); color: var(--emerald-800); font-size: .85rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.box-tile small { font-size: .68rem; font-weight: 500; direction: ltr; }
.box-tile.is-busy { background: var(--gold-100); border-color: var(--gold-500); color: var(--gold-700); }

/* ---------- الدخول ---------- */
body.login-page { min-height: 100vh; background: var(--navy-900); overflow-x: hidden; }
.login-branch { position: fixed; inset-block-start: -10px; inset-inline-start: -20px; width: min(520px, 70vw); height: 260px; color: var(--gold-500); opacity: .22; pointer-events: none; }
.login-branch.is-end { inset-block-start: auto; inset-block-end: -10px; inset-inline-start: auto; inset-inline-end: -20px; transform: rotate(180deg); }
.login-page .container { position: relative; z-index: 1; padding: 1rem; display: grid; place-items: center; min-height: 100vh; }
.login-wrap { width: 100%; display: grid; place-items: center; }
.login-card { width: min(400px, 100%); margin: 0; display: flex; flex-direction: column; gap: .75rem; text-align: center; background: var(--ivory); border-color: var(--navy-700); box-shadow: var(--shadow-lg); padding: 1.3rem 1.5rem; }
.login-brand { display: grid; justify-items: center; gap: .15rem; color: var(--navy-800); }
.login-brand .logo-mark { width: 54px; height: 54px; }
.login-brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.7rem; letter-spacing: .12em; line-height: 1.15; direction: ltr; color: var(--navy-900); }
.login-brand-sub { font-size: .9rem; color: var(--gold-700); font-weight: 600; }
.login-logo { max-height: 72px; width: auto; align-self: center; }
.pin-field { display: flex; flex-direction: column; gap: .2rem; text-align: start; font-weight: 600; cursor: pointer; }
.pin-field > span { font-size: .85rem; }
.pin-field input { text-align: center; font-size: 1.55rem !important; letter-spacing: .3em; font-weight: 600; min-height: 54px !important; caret-color: var(--navy-800); }
.pin-field.is-active input { border-color: var(--navy-600); box-shadow: var(--focus-ring); }
.pin-field input.shake { animation: shake .3s; border-color: var(--danger); }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-2px); } }
.login-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; direction: ltr; }
.login-keypad .k-muted { font-size: .95rem; color: var(--text-muted); background: var(--bg-subtle); }

/* ---------- النوافذ ولوحات الأرقام ---------- */
.dialog { border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.4rem; max-width: 460px; width: calc(100% - 2rem); box-shadow: var(--shadow-lg); color: var(--text-main); }
.dialog::backdrop { background: rgba(11,22,40,.5); }
.dialog-message { font-size: 1.05rem; font-weight: 500; margin-top: 0; }
.dialog-actions { display: flex; gap: .7rem; justify-content: flex-end; }
.numpad { position: fixed; inset: 0; background: rgba(11,22,40,.5); display: grid; place-items: center; z-index: 50; }
.numpad-panel { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 1.1rem; width: min(380px, calc(100% - 2rem)); }
.numpad-label { font-weight: 600; color: var(--text-muted); margin-bottom: .4rem; }
.numpad-display { direction: ltr; text-align: right; font-size: 2.1rem; font-weight: 700; font-variant-numeric: tabular-nums; padding: .35rem .8rem; border: 1px solid var(--border-strong); border-radius: var(--radius-md); margin-bottom: .7rem; min-height: 62px; }
.numpad-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; direction: ltr; }
.numpad-actions { display: grid; grid-template-columns: 1fr 2fr; gap: .6rem; margin-top: .7rem; }
.numpad-keys button, .keypad button, .login-keypad button {
    min-height: 62px; font: inherit; font-size: 1.6rem; font-weight: 600; color: var(--navy-900); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-card);
    cursor: pointer; touch-action: manipulation; transition: background var(--dur-fast);
}
.numpad-keys button:hover, .keypad button:hover, .login-keypad button:hover { background: var(--navy-50); }
.numpad-keys button:active, .keypad button:active, .login-keypad button:active { background: var(--navy-100); }
.login-keypad button { min-height: 54px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .8rem; direction: ltr; }
.keypad button:disabled { opacity: .3; }
.big-input { font-size: 2.5rem !important; font-weight: 700; text-align: center; min-height: 76px !important; font-variant-numeric: tabular-nums; }
.print-ask { text-align: center; min-width: min(420px, 92vw); }
.print-ask h2 { margin: .5rem 0 0; font-size: 1.2rem; }
.print-ask-code { font-size: 4rem; font-weight: 700; line-height: 1.1; direction: ltr; color: var(--navy-900); }
.print-ask-name { font-size: 1.15rem; font-weight: 600; margin: .2rem 0 .4rem; }
.print-ask > p:first-child { margin: 0; }
.print-ask-actions { display: grid; grid-template-columns: 2fr 1fr; gap: .6rem; margin-top: 1rem; }

/* ---------- نقطة البيع ---------- */
form.pos { display: grid; grid-template-columns: minmax(250px, .85fr) minmax(460px, 1.7fr) minmax(300px, 1fr); gap: .7rem; align-items: stretch; }
.quote { margin-top: 1rem; text-align: center; }
.quote-amount { font-size: 2.3rem; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; direction: ltr; }
.quote-error { color: var(--danger); font-weight: 600; }
.special-tariff { text-align: start; margin-top: .5rem; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.seg { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 54px; padding: 0 .4rem; border: 1px solid var(--border-strong); border-radius: var(--radius-md); font-weight: 600; background: var(--bg-card); transition: background var(--dur-fast); }
.seg input:hover:not(:checked):not(:disabled) + span { background: var(--navy-50); }
.seg input:checked + span { border-color: var(--navy-800); background: var(--navy-800); color: #fff; }
.seg input:disabled + span { opacity: .4; cursor: not-allowed; }
.seg input:focus-visible + span { outline: 2px solid var(--navy-600); outline-offset: 2px; }
.pay-fields { display: grid; gap: .5rem; }
.remaining { font-weight: 600; color: var(--warning); font-size: .85rem; margin-inline-start: .4rem; }
.farmer-picker { display: grid; gap: .4rem; min-height: 0; }
.farmer-chip { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem .8rem; border: 1px solid var(--navy-600); border-radius: var(--radius-md); background: var(--navy-50); font-weight: 600; }
.farmer-results { display: grid; gap: .3rem; max-height: 220px; overflow-y: auto; }
.farmer-result { text-align: start; min-height: 46px; padding: .3rem .8rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-card); font: inherit; cursor: pointer; }
.farmer-result:hover { border-color: var(--navy-600); }
.pos-col { margin: 0; padding: .85rem; display: flex; flex-direction: column; gap: .5rem; min-height: 0; }
.pos-col-head { display: flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--navy-900); }
.pos-step { width: 24px; height: 24px; border-radius: 50%; background: var(--navy-800); color: #fff; display: grid; place-items: center; font-size: .8rem; flex: none; }
.pos-col-link { margin-inline-start: auto; font-size: .82rem; font-weight: 500; }
.pos-hint { margin: auto 0; text-align: center; }
.pos-weight .big-input { min-height: 62px !important; font-size: 2.2rem !important; }
.pos-weight .keypad { margin-top: 0; }
.pos-tariff { font-size: .88rem; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.pos-tariff .special-tariff { margin: 0; flex-basis: 100%; }
.pos-notes summary, #farmer-new summary { cursor: pointer; color: var(--text-muted); font-size: .88rem; font-weight: 600; }
.pos-notes input { margin-top: .3rem; }
.pos-bar { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto minmax(300px, 34%); align-items: center; gap: 1rem; background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: .5rem .7rem; }
.pos-summary-wrap { display: grid; gap: .3rem; min-width: 0; }
.pos-summary { display: flex; flex-wrap: wrap; gap: .4rem; font-weight: 500; min-width: 0; }
.pos-summary span { background: var(--bg-subtle); border-radius: var(--radius-sm); padding: .1rem .55rem; }
.pos-amount { display: grid; text-align: center; line-height: 1.15; }
.pos-amount small { color: var(--text-muted); font-weight: 500; }
.pos-amount span { font-size: 2.1rem; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos-confirm { min-height: 68px; font-size: 1.3rem; background: var(--emerald-700); color: #fff; }
.pos-confirm:hover { background: var(--emerald-800); }
.pos-confirm[disabled] { opacity: 1; background: var(--stone-200); color: var(--ink-600); font-size: 1.05rem; }
.pos-cash-closed { color: var(--danger); font-weight: 600; font-size: .9rem; }
.pos-toast { position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%); z-index: 60; max-width: min(900px, calc(100% - 2rem)); padding: 12px 18px; border-radius: var(--radius-md); font-weight: 600; box-shadow: var(--shadow-lg); cursor: pointer; }
.pos-toast.is-ok { background: var(--success-bg); color: var(--emerald-800); border: 1px solid var(--success-border); }
.pos-toast.is-error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.pos-toast strong { font-size: 1.1rem; }
body.pos-page #print-feedback { display: none !important; }
body.pos-page .topbar { flex: none; }
@media (min-width: 1000px) and (min-height: 560px) {
    body.pos-page { height: 100vh; overflow: hidden; }
    body.pos-page .app-shell { height: 100vh; min-height: 0; }
    body.pos-page main.container { flex: 1; min-height: 0; display: flex; flex-direction: column; max-width: none; padding: .6rem .8rem; }
    body.pos-page main.container > .alert { margin-bottom: .5rem; padding: .45rem .9rem; }
    body.pos-page form.pos { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr) auto; }
    .pos-col { overflow: hidden; }
    .pos-weight .keypad { flex: 1; min-height: 0; grid-auto-rows: 1fr; }
    .pos-weight .keypad button { min-height: 0; }
    .machine-options { flex: 1; min-height: 0; }
    .pos-pay { overflow-y: auto; }
    form.pos .farmer-results { max-height: 150px; }
}
@media (min-width: 1000px) and (max-width: 1250px) { form.pos { grid-template-columns: minmax(210px, .8fr) minmax(370px, 1.6fr) minmax(250px, 1fr); gap: .5rem; } }
@media (max-width: 999px) {
    form.pos { grid-template-columns: minmax(0, 1fr); }
    .pos-bar { position: sticky; bottom: .4rem; z-index: 5; display: flex; align-items: center; gap: .6rem; padding: .45rem .55rem; }
    .pos-summary-wrap, .pos-amount small { display: none; }
    .pos-amount { flex: none; }
    .pos-amount span { font-size: 1.5rem; }
    .pos-confirm { flex: 1; min-height: 58px; font-size: 1.1rem; }
}

/* ---------- بطاقات الآلات داخل نقطة البيع ---------- */
.machine-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); grid-auto-rows: minmax(150px, 220px); gap: .5rem; align-content: start; overflow-y: auto; }
.machine-option { display: flex; flex-direction: column; justify-content: flex-start; gap: .28rem; position: relative; overflow: hidden; text-align: start; padding: .45rem .6rem; font: inherit; color: var(--text-main); cursor: pointer; background: var(--bg-card); border: 1px solid var(--border-color); border-inline-start: 4px solid var(--border-strong); border-radius: var(--radius-md); transition: border-color var(--dur-fast), background var(--dur-fast); }
.machine-option > * { flex-shrink: 0; }
.machine-option:not(.is-static):hover { background: var(--row-hover); }
.machine-option.is-static { cursor: default; }
.machine-option.is-off { opacity: .6; }
.mo-head { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.mo-head > * { min-width: 0; }
.mo-icon { width: 38px; height: 38px; padding: 3px; border-radius: var(--radius-md); background: var(--navy-50); flex: none !important; display: grid; place-items: center; }
.mo-name { font-size: 1.02rem; font-weight: 700; flex: 1 1 auto; min-width: 2.5em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--navy-900); }
.mo-badge, .mo-pill { font-size: .72rem; font-weight: 600; padding: .03rem .45rem; border-radius: var(--radius-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-badge { background: var(--navy-800); color: #fff; }
.mo-line { font-size: .82rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-line:empty { display: none; }
.mo-state { font-size: .85rem; font-weight: 600; }
.mo-now { display: flex; justify-content: space-between; align-items: baseline; gap: .4rem; min-width: 0; white-space: nowrap; font-size: .85rem; font-weight: 500; color: var(--text-muted); }
.mo-now b { font-size: 1rem; color: var(--text-main); font-variant-numeric: tabular-nums; direction: ltr; display: inline-block; }
.mo-cur { overflow: hidden; text-overflow: ellipsis; }
.mo-times { flex: none; }
.mo-next { font-size: .8rem; font-weight: 500; color: var(--navy-700); background: var(--navy-50); border-radius: var(--radius-sm); padding: .08rem .4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-next small { color: var(--text-muted); }
.mo-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .3rem; }
.mo-stat { display: grid; justify-items: center; min-width: 0; background: var(--bg-subtle); border-radius: var(--radius-sm); padding: .12rem .1rem; line-height: 1.15; }
.mo-stat b { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mo-stat small { font-size: .66rem; color: var(--text-muted); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.mo-stat.is-countdown b { color: var(--warning); }
.mo-stat.is-clock b { color: var(--navy-600); }
.mo-yours { font-size: .78rem; background: var(--bg-subtle); border-radius: var(--radius-sm); padding: .12rem .4rem; margin-top: auto; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-yours strong { color: var(--navy-800); }
.mo-yours small { opacity: .8; }
.machine-option.is-selected { border-color: var(--navy-800); box-shadow: 0 0 0 2px var(--navy-800); }
.machine-option.is-selected .mo-yours { background: var(--navy-800); color: #fff; }
.machine-option.is-selected .mo-yours strong { color: #fff; }
.mo-load { display: flex; height: 8px; border-radius: 4px; background: var(--neutral-bg); overflow: hidden; }
.mo-load-wait { background: var(--gold-500); }
.mo-load-proc { background: var(--navy-800); }
.mo-progress { display: block; width: 100%; height: 7px !important; flex: none; }
.mo-finish { display: grid; text-align: center; line-height: 1.1; }
.mo-finish small { color: var(--text-muted); font-size: .75rem; }
.mo-finish b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.mo-list { flex: none !important; width: 32px; height: 32px; border-radius: var(--radius-sm); display: grid; place-items: center; border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--navy-800); cursor: pointer; }
.mo-list:hover { background: var(--navy-50); }
.st-busy { border-inline-start-color: var(--gold-500); }
.st-free { border-inline-start-color: var(--emerald-700); }
.st-ready { border-inline-start-color: var(--navy-600); }
.st-paused { border-inline-start-color: var(--neutral-text); }
.st-off { border-inline-start-color: var(--danger); }
.st-busy .mo-pill, .st-busy .mc-badge { background: var(--warning-bg); color: var(--warning); }
.st-free .mo-pill { background: var(--emerald-50); color: var(--emerald-800); }
.st-free .mo-now { color: var(--emerald-800); }
.st-ready .mo-pill { background: var(--navy-50); color: var(--navy-800); }
.st-paused .mo-pill { background: var(--neutral-bg); color: var(--neutral-text); }
.st-off .mo-pill { background: var(--danger-bg); color: var(--danger); }
.machine-option.st-off { opacity: .7; }
@media (max-height: 700px) and (min-width: 1000px) {
    .machine-option { gap: .18rem; padding: .32rem .5rem; }
    .mo-icon { width: 30px; height: 30px; padding: 2px; }
    .mo-list { width: 28px; height: 28px; }
    .mo-now, .mo-next { font-size: .76rem; }
    .mo-stat b { font-size: .95rem; }
    .mo-yours { font-size: .74rem; }
    .pos-col { padding: .6rem; }
}

/* ---------- أيقونة المعصرة والوقت ---------- */
.oil-press { width: 100%; height: 100%; display: block; overflow: visible; }
.oil-press .op-hopper { fill: var(--emerald-700); }
.oil-press .op-olive { fill: var(--emerald-800); }
.oil-press .op-olive.alt { fill: var(--navy-800); }
.oil-press .op-body { fill: var(--navy-700); }
.oil-press .op-gauge { fill: #fff; stroke: var(--navy-700); stroke-width: 1; }
.oil-press .op-needle { stroke: var(--danger); }
.oil-press .op-drop { fill: var(--gold-500); opacity: .3; }
.oil-press.is-busy .op-drop { opacity: 1; }
.t-countdown { color: var(--warning) !important; font-variant-numeric: tabular-nums; direction: ltr; display: inline-block; }
.t-countdown.late { color: var(--danger) !important; }
.t-countdown.is-frozen { color: var(--neutral-text) !important; }
.t-clock { color: var(--navy-600) !important; font-variant-numeric: tabular-nums; direction: ltr; display: inline-block; }
.progress { display: block; height: 10px; border-radius: 5px; background: var(--neutral-bg); overflow: hidden; direction: rtl; }
.progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--gold-500); transition: width 1s linear; }
.progress.overdue > span { background: var(--danger); }
.progress.is-paused > span { background: var(--stone-300); }
.progress.big { height: 16px; }

/* ---------- لوحة الآلات ---------- */
.live-dot { color: var(--success); font-weight: 600; font-size: .85rem; }
.live-dot.offline { color: var(--danger); }
.machine-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.machine-card { display: flex; flex-direction: column; gap: .65rem; min-height: 210px; text-align: start; font: inherit; color: var(--text-main); background: var(--bg-card); border: 1px solid var(--border-color); border-block-start: 3px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 1rem; cursor: pointer; transition: border-color var(--dur-fast), background var(--dur-fast); }
.machine-card:hover { background: var(--row-hover); border-inline-color: var(--border-hover); border-block-end-color: var(--border-hover); }
.mc-head { display: flex; align-items: center; gap: .6rem; }
.mc-icon { width: 46px; height: 46px; padding: 3px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--navy-50); flex: none; }
.mc-name { font-size: 1.1rem; font-weight: 700; flex: 1; color: var(--navy-900); }
.mc-badge { font-size: .78rem; font-weight: 600; padding: .1rem .55rem; border-radius: var(--radius-sm); background: var(--neutral-bg); color: var(--neutral-text); white-space: nowrap; }
.state-busy { border-block-start-color: var(--gold-500); }
.state-busy .mc-icon { background: var(--gold-100); }
.state-busy .mc-badge { background: var(--warning-bg); color: var(--warning); }
.state-idle { border-block-start-color: var(--emerald-700); }
.state-idle .mc-icon { background: var(--emerald-50); }
.state-idle .mc-badge { background: var(--emerald-50); color: var(--emerald-800); }
.state-ready { border-block-start-color: var(--navy-600); }
.state-ready .mc-badge { background: var(--navy-50); color: var(--navy-800); }
.state-paused { border-block-start-color: var(--neutral-text); }
.state-paused .mc-icon { background: var(--neutral-bg); }
.state-paused .mc-badge { background: var(--neutral-bg); color: var(--neutral-text); }
.state-off { border-block-start-color: var(--danger); background: var(--bg-subtle); }
.state-off .mc-badge { background: var(--danger-bg); color: var(--danger); }
.mc-current { display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.mc-ticket { font-size: 2.1rem; font-weight: 700; line-height: 1.1; color: var(--navy-900); }
.mc-ticket small { font-size: .9rem; font-weight: 500; color: var(--text-muted); }
.mc-weight { white-space: nowrap; }
.mc-empty { justify-content: center; color: var(--text-muted); font-weight: 500; }
.mc-times { display: flex; justify-content: space-between; font-size: .92rem; }
.mc-times b, .md-row b { font-variant-numeric: tabular-nums; font-size: 1.1rem; direction: ltr; display: inline-block; }
.mc-foot { display: flex; flex-wrap: wrap; gap: .35rem; }
.mc-chip { font-size: .8rem; font-weight: 500; padding: .1rem .55rem; border-radius: var(--radius-sm); background: var(--bg-subtle); color: var(--text-muted); }
.mc-chip.has { background: var(--navy-50); color: var(--navy-800); }
.machine-dialog { max-width: 760px; width: calc(100% - 2rem); max-height: 88vh; overflow-y: auto; }
.md-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.md-head h2 { margin: 0; flex: 1; display: flex; align-items: center; gap: .5rem; }
.md-icon { display: inline-block; width: 38px; height: 38px; vertical-align: middle; }
.md-current { border: 1px solid var(--gold-500); background: var(--gold-100); border-radius: var(--radius-md); padding: .8rem; margin-bottom: 1rem; display: grid; gap: .6rem; }
.md-current.is-paused { border-color: var(--border-strong); background: var(--neutral-bg); }
.md-paused, .mc-paused { background: var(--neutral-bg); color: var(--neutral-text); border-radius: var(--radius-sm); padding: .3rem .6rem; font-weight: 500; font-size: .88rem; }
.md-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.md-spacer { flex: 1; }
.md-num { font-size: 1.25rem; font-weight: 700; text-decoration: none; color: var(--navy-900); }
.md-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.md-actions select { width: auto; }
.md-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.md-item { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: .6rem .8rem; display: grid; gap: .5rem; }
.md-auto { font-size: .75rem; font-weight: 600; background: var(--navy-50); color: var(--navy-800); border-radius: var(--radius-sm); padding: .03rem .45rem; }
.md-move, .md-pause { display: inline-flex; align-items: center; gap: .35rem; }
.md-pause select { width: auto; }

/* ---------- قائمة الانتظار القديمة ---------- */
.queue-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.queue-col { padding: .8rem; margin: 0; }
.queue-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.queue-head h2 { margin: 0; flex: 1; }
.queue-head .small { width: 100%; }
.queue-item { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: .6rem .7rem; margin-bottom: .5rem; }
.queue-item.is-processing { border-color: var(--gold-500); background: var(--gold-100); }
.qi-top { display: flex; justify-content: space-between; font-weight: 600; }
.qi-num { font-size: 1.1rem; text-decoration: none; }
.qi-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; align-items: center; }
.qi-actions .form-inline select, .qi-actions .form-inline input { min-height: 38px; width: auto; max-width: 140px; font-size: .9rem; padding: .2rem .5rem; }

/* ---------- شاشة العون ---------- */
.rc-new-btn { width: 100%; min-height: 72px; font-size: 1.35rem; margin-bottom: .8rem; }
.rc-filter { display: flex; gap: .4rem; margin-bottom: .8rem; flex-wrap: wrap; }
.rc-filter input { flex: 1; min-width: 160px; }
.rc-filter .btn { white-space: nowrap; }
.rc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: .7rem; }
.rc-card { display: flex; flex-direction: column; overflow: hidden; background: var(--bg-card); border: 1px solid var(--border-color); border-inline-start: 4px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.rc-card.is-waiting { border-inline-start-color: var(--gold-500); }
.rc-card.is-weighed { border-inline-start-color: var(--emerald-700); }
.rc-main { display: grid; gap: .1rem; padding: .7rem .9rem; color: var(--text-main); text-decoration: none; flex: 1; justify-items: start; }
.rc-main:hover { background: var(--row-hover); }
.rc-code { font-size: 2.2rem; font-weight: 700; line-height: 1.1; direction: ltr; color: var(--navy-900); }
.rc-name { font-weight: 600; }
.rc-line { color: var(--text-muted); font-size: .88rem; }
.rc-weight { font-weight: 600; font-variant-numeric: tabular-nums; }
.rc-amount { font-size: 1.35rem; font-weight: 700; color: var(--emerald-700); font-variant-numeric: tabular-nums; }
.rc-actions { display: flex; gap: .3rem; padding: .35rem .7rem .6rem; align-items: center; flex-wrap: wrap; }
.rc-actions .inline { flex: 1; }
.rc-actions input { min-height: 36px !important; font-size: .85rem !important; flex: 1; min-width: 90px; }
.rc-empty { grid-column: 1 / -1; text-align: center; padding: 2rem; }
.wg { display: grid; grid-template-columns: minmax(300px, 1.3fr) minmax(260px, 1fr); gap: .8rem; align-items: start; padding-bottom: .5rem; }
.wg-col { margin: 0; padding: 1rem; display: grid; gap: .6rem; }
.wg-col-weight { order: 1; }
.wg-bar { order: 2; }
.wg-two { display: grid; grid-template-columns: 1fr 1.4fr; gap: .5rem; }
.wg .field input { min-height: 48px; }
.wg .big-input { min-height: 70px !important; }
.wg .keypad button { min-height: 60px; }
.wg-total { display: grid; justify-items: center; line-height: 1.2; padding: .45rem .6rem; background: var(--success-bg); border: 1px solid var(--success-border); border-radius: var(--radius-md); }
.wg-total small { color: var(--emerald-800); font-weight: 600; font-size: .85rem; }
.wg-total b { font-size: 2.3rem; font-weight: 700; color: var(--emerald-700); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wg .keypad { margin-top: 0; }
.wg-box-add { display: grid; grid-template-columns: 1fr auto; gap: .4rem; }
.wg-box-error { color: var(--danger); font-weight: 600; font-size: .88rem; }
.wg-box-note { color: var(--emerald-800); font-weight: 600; font-size: .88rem; }
.box-busy { text-align: center; }
.box-busy h2 { font-size: 1.25rem; margin: 0 0 .5rem; }
.box-busy p { margin: .25rem 0; }
.box-busy-ticket { font-size: 1.15rem; font-weight: 600; }
.box-busy-ticket b { font-size: 2.6rem; font-weight: 700; color: var(--navy-900); line-height: 1.15; display: block; }
.box-busy-ask { font-size: 1.1rem; font-weight: 700; margin-top: .8rem !important; }
.box-busy-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; }
.wg-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.wg-chip { border: 0; border-radius: var(--radius-md); min-height: 44px; padding: 0 .9rem; font: inherit; font-weight: 700; font-size: 1.1rem; color: #fff; cursor: pointer; background: var(--navy-800); }
.wg-chip:hover { background: var(--navy-900); }
.wg-seg { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); margin: 0; }
.wg-bar { grid-column: 1 / -1; display: flex; position: sticky; bottom: .4rem; z-index: 5; align-items: center; gap: 1rem; }
.wg-bar .pos-confirm { flex: 1; }
.wg-tap { min-height: 64px !important; width: 100%; font-size: 1.35rem !important; font-weight: 700; text-align: center; cursor: pointer; }
.wg-machine-btn { display: flex; align-items: center; justify-content: center; gap: .5rem; border: 1px solid var(--navy-600); border-radius: var(--radius-md); background: var(--navy-50); color: var(--navy-900); font-family: inherit; font-size: 1.05rem !important; padding: .3rem .5rem; transition: background var(--dur-fast); }
.wg-machine-btn:hover:not(:disabled) { background: var(--navy-100); }
.wg-machine-btn:disabled { opacity: .6; cursor: not-allowed; border-color: var(--border-color); }
.wg-machine-icon { width: 36px; height: 36px; flex: none; }
.picker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: .6rem; }
.picker-card { display: grid; gap: .3rem; grid-template-columns: 48px 1fr; align-items: center; justify-items: start; min-height: 96px; text-align: start; font: inherit; color: var(--text-main); padding: .7rem .8rem; border-radius: var(--radius-md); background: var(--bg-card); border: 1px solid var(--border-strong); border-inline-start-width: 4px; cursor: pointer; transition: background var(--dur-fast); }
.picker-card:hover:not(:disabled) { background: var(--row-hover); }
.picker-card > .picker-now, .picker-card > .picker-stats { grid-column: 1 / -1; }
.picker-auto { grid-template-columns: 1fr; border-inline-start-color: var(--gold-500); }
.picker-icon { width: 44px; height: 44px; }
.picker-name { font-weight: 700; font-size: 1.1rem; color: var(--navy-900); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.picker-now { font-size: .95rem; font-weight: 500; }
.picker-code { font-size: 1.45rem; font-weight: 700; color: var(--navy-900); }
.picker-stats { display: flex; flex-wrap: wrap; gap: .7rem; font-size: .85rem; color: var(--text-muted); }
.picker-stats b { color: var(--text-main); }
.picker-card.st-off { opacity: .55; cursor: not-allowed; }
.picker-card.is-selected { border-color: var(--navy-800); box-shadow: 0 0 0 2px var(--navy-800); }

/* ---------- شاشة الصندوق ---------- */
.money { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--navy-900); }
.money.is-out { color: var(--danger); }
.money.neg { color: var(--danger); }
.money-input { font-variant-numeric: tabular-nums; font-weight: 700; text-align: center; }
.ch-stats { display: grid; grid-template-columns: minmax(230px, 1.5fr) repeat(4, minmax(0, 1fr)) auto; gap: .6rem; align-items: stretch; margin-bottom: .8rem; }
html:not(.show-private) .ch-private { display: none !important; }
.ch-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.ch-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.ch-summary { display: flex; flex-wrap: wrap; gap: .4rem; }
.ch-sum { display: flex; align-items: center; gap: .45rem; min-height: 44px; padding: .15rem .8rem; background: var(--bg-card); border: 1px solid var(--border-color); border-inline-start: 4px solid var(--border-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.ch-sum b { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--navy-900); }
.ch-sum span { font-size: .8rem; color: var(--text-muted); white-space: nowrap; }
.ch-sum.is-work { border-inline-start-color: var(--gold-500); background: var(--gold-100); }
.ch-sum.is-work b { color: var(--gold-700); }
.ch-sum.is-wait { border-inline-start-color: var(--navy-600); background: var(--navy-50); }
.ch-sum.is-due { border-inline-start-color: var(--danger); }
.ch-sum.is-due b { color: var(--danger); }
.ch-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; margin-bottom: .55rem; padding: .25rem; background: var(--bg-subtle); border-radius: var(--radius-md); }
.ch-tab { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 38px; border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none; font-size: .88rem; font-weight: 600; transition: background var(--dur-fast), color var(--dur-fast); }
.ch-tab:hover { color: var(--navy-900); }
.ch-tab.is-active { background: var(--navy-800); color: #fff; }
.ch-tab b { font-variant-numeric: tabular-nums; }
.ch-ticket-end { display: grid; justify-items: end; gap: .1rem; }
.ch-list { display: flex; flex-direction: column; min-width: 0; }
.ch-list .rc-filter { flex: none; }
.ch-pay:has(.ch-empty) { display: grid; place-items: center; }
.ch-machines-wrap { margin-bottom: 1rem; }
.ch-machines-wrap h2 { margin-bottom: .45rem; }
.ch-machines { display: flex; gap: .7rem; overflow-x: auto; padding: 2px 2px .5rem; scroll-snap-type: x proximity; }
.strip-card { --sc: var(--neutral-text); --sc-soft: var(--neutral-bg); flex: 1 0 240px; max-width: 420px; display: flex; flex-direction: column; overflow: hidden; scroll-snap-align: start; padding: 0; font: inherit; text-align: start; color: var(--text-main); cursor: pointer; background: var(--bg-card); border: 1px solid var(--sc); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); transition: box-shadow var(--dur-fast); }
.strip-card:hover { box-shadow: var(--shadow-lg); }
.sc-busy { --sc: var(--gold-700); --sc-soft: var(--gold-100); }
.sc-idle { --sc: var(--emerald-700); --sc-soft: var(--emerald-50); }
.sc-ready { --sc: var(--navy-600); --sc-soft: var(--navy-50); }
.sc-off { --sc: var(--danger); --sc-soft: var(--danger-bg); }
.strip-head { display: flex; align-items: center; gap: .5rem; padding: .35rem .6rem; background: var(--sc); color: #fff; }
.strip-icon { width: 32px; height: 32px; flex: none; padding: 2px; border-radius: var(--radius-sm); background: #fff; }
.strip-name { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-state { font-size: .76rem; font-weight: 600; white-space: nowrap; }
.strip-body { display: grid; align-content: center; gap: .3rem; flex: 1; min-height: 82px; padding: .45rem .7rem; }
.strip-now { font-size: .85rem; color: var(--text-muted); white-space: nowrap; }
.strip-now b { font-size: 1.55rem; font-weight: 700; line-height: 1.1; color: var(--navy-900); }
.strip-card .progress { height: 8px; background: var(--sc-soft); }
.strip-card .progress > span { background: var(--sc); }
.strip-card .progress.overdue > span { background: var(--danger); }
.strip-times { display: flex; justify-content: space-between; gap: .4rem; font-size: .82rem; white-space: nowrap; }
.strip-times b { font-size: .95rem; }
.strip-empty { text-align: center; color: var(--sc); font-weight: 600; }
.strip-foot { display: flex; justify-content: space-between; gap: .4rem; padding: .25rem .7rem; background: var(--sc-soft); font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
.strip-foot b { color: var(--navy-900); font-variant-numeric: tabular-nums; }
.ch-stats-5 { grid-template-columns: minmax(230px, 1.5fr) repeat(4, minmax(0, 1fr)); }
.ch-drawer { display: grid; align-content: center; padding: .55rem 1rem; background: var(--navy-900); color: #fff; border-radius: var(--radius-lg); line-height: 1.25; }
.ch-drawer span { font-size: .8rem; color: var(--gold-100); font-weight: 500; }
.ch-drawer strong { font-size: 1.85rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ch-drawer small { font-size: .72rem; color: var(--side-text); }
.ch-figure { display: grid; align-content: center; min-width: 0; padding: .5rem .8rem; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); line-height: 1.3; }
.ch-figure span { font-size: .76rem; color: var(--text-muted); }
.ch-figure strong { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--navy-900); }
.ch-figure.is-in strong { color: var(--emerald-700); }
.ch-figure.is-out strong { color: var(--danger); }
.ch-figure.is-discount strong { color: var(--gold-700); }
.ch-tools { display: grid; gap: .35rem; align-content: center; }
.ch-tools .btn { min-height: 38px; padding: .15rem .8rem; font-size: .88rem; white-space: nowrap; }
@media (max-width: 1280px) { .ch-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } .ch-drawer { grid-column: span 2; } .ch-tools { grid-column: span 2; grid-template-columns: 1fr 1fr; } .ch-stats-5 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .ch-stats-5 .ch-drawer { grid-column: 1 / -1; } }
@media (max-width: 1100px) { .ch-due { flex-wrap: wrap; padding-inline: .6rem; } .ch-due b { font-size: 1.8rem; } .ch-layout { min-width: 0; } .ch-pay form > * { min-width: 0; } .ch-pay .pos-confirm { font-size: 1.05rem; padding-inline: .4rem; } }
@media (max-width: 900px) { .ch-stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ch-figure strong { font-size: 1.05rem; } .ch-actions .btn { padding-inline: .7rem; } }
@media (max-width: 640px) { .ch-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ch-drawer, .ch-tools { grid-column: 1 / -1; } .summary-table td { white-space: normal; } }
.quick-expense form { display: grid; gap: .7rem; }
.quick-expense h2 { margin-bottom: .7rem; }
.quick-expense .alert { margin-bottom: .7rem; }
.quick-expense-actions { display: grid; grid-template-columns: 2fr 1fr; gap: .6rem; }
.summary-table td { text-align: end; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ch-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: .8rem; align-items: stretch; margin-bottom: .8rem; }
.ch-layout > .card, .ch-side > .card { padding: 1rem; margin: 0; }
.ch-side { display: grid; gap: .8rem; min-width: 0; }
.ch-running h2 { margin-bottom: .5rem; }
.ch-run-list { display: grid; grid-template-columns: minmax(0, 1fr); scrollbar-width: thin; scrollbar-gutter: stable; gap: .3rem; align-content: start; max-height: max(190px, 32vh); overflow-y: auto; }
.ch-run { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .55rem; padding: .3rem .55rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); color: var(--text-main); text-decoration: none; font-size: .9rem; transition: background var(--dur-fast); }
a.ch-run:hover { background: var(--row-hover); border-color: var(--border-hover); }
.ch-run.is-selected { border-color: var(--navy-800); background: var(--navy-50); }
.ch-run-code { font-size: 1.15rem; font-weight: 700; direction: ltr; color: var(--navy-900); }
.ch-run .ch-name small { font-size: .76rem; }
.ch-run .t-clock { font-weight: 600; }
.ch-run-end { display: grid; justify-items: end; gap: .1rem; }
.ch-run-end b { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--navy-900); }
.ch-tickets { flex: 1 1 0; min-height: 270px; display: grid; grid-template-columns: minmax(0, 1fr); gap: .35rem; align-content: start; overflow-y: auto; scrollbar-width: thin; scrollbar-gutter: stable; }
.ch-ticket { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .7rem; padding: .45rem .7rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); color: var(--text-main); text-decoration: none; transition: background var(--dur-fast); }
.ch-ticket:hover { background: var(--row-hover); border-color: var(--border-hover); }
.ch-ticket.is-selected { border-color: var(--navy-800); background: var(--navy-50); }
.ch-code { font-size: 1.45rem; font-weight: 700; direction: ltr; color: var(--navy-900); }
.ch-code.big { font-size: 2.1rem; }
.ch-name { display: grid; font-weight: 600; }
.ch-name small { color: var(--text-muted); font-weight: 400; }
.ch-head { display: flex; align-items: center; gap: .8rem; font-size: 1.1rem; margin-bottom: .2rem; }
.ch-due { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin: .35rem 0 .1rem; padding: .35rem .9rem; background: var(--navy-50); border: 1px solid var(--navy-100); border-radius: var(--radius-md); }
.ch-due small { font-size: .9rem; font-weight: 600; color: var(--navy-800); }
.ch-due b { font-size: 2.3rem; line-height: 1.2; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ch-discount { background: var(--gold-100); color: var(--gold-700); border-radius: var(--radius-md); padding: .3rem .7rem; font-weight: 700; margin: .3rem 0; }
.ch-discount.is-bad { background: var(--danger-bg); color: var(--danger); }
.ch-pay .details { grid-template-columns: repeat(2, max-content 1fr); gap: .1rem .6rem; font-size: .88rem; }
.ch-pay form { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .6rem; align-items: end; }
.ch-due, .ch-discount, .ch-pay .pos-confirm { grid-column: 1 / -1; }
.ch-pay .big-input { min-height: 52px !important; font-size: 1.5rem !important; }
.ch-pay select { min-height: 52px; }
.ch-pay .pos-confirm { min-height: 60px; }
.ch-empty { text-align: center; padding: 1.2rem 1rem; margin: 0; }
.tr-pay { padding: .8rem 1rem; }
.tr-type { margin-bottom: .6rem; }

/* ---------- متجاوب ---------- */
@media (max-width: 1099px) {
    html, html.sb-collapsed { --side-w: 256px; }
    .app-shell { margin-inline-start: 0; }
    .side-open { display: inline-grid; }
    .sidebar { transform: translateX(100%); box-shadow: var(--shadow-lg); }
    [dir=ltr] .sidebar { transform: translateX(-100%); }
    html.sb-open .sidebar { transform: none; }
    html.sb-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(11,22,40,.5); }
    html.sb-collapsed .side-brand { justify-content: flex-start; padding-inline: .9rem; }
    html.sb-collapsed .side-brand-text { display: grid; }
    html.sb-collapsed .side-link span { display: inline; }
    html.sb-collapsed .side-group { display: block; }
    html.sb-collapsed .side-link { justify-content: flex-start; padding: 0 .6rem; }
    html.sb-collapsed .side-user { justify-content: flex-start; }
    html.sb-collapsed .side-user-text { display: grid; }
    html.sb-collapsed .side-user form { display: block; }
    .side-collapse { display: none; }
    .dash-grid { grid-template-columns: minmax(0, 1fr); }
    .dash-branch { display: none; }
}
@media (max-width: 760px) {
    .grid-2, .wg, .ch-layout { grid-template-columns: minmax(0, 1fr); }
    .big-input { font-size: 2rem !important; }
    .keypad button { min-height: 56px; }
    .user-name { display: none; }
    .card { padding: 1rem; }
}
@media (max-width: 640px) {
    .container { padding: .8rem; }
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
    .tile { min-height: 108px; }
    .stat strong { font-size: 1.25rem; }
    .pill-clock .icon { display: none; }
    .pill-clock { font-size: .75rem; }
    .topbar { padding: 0 .7rem; gap: .45rem; }
    .crumbs a, .crumbs i { display: none; }
    .user-chip { display: none; }
    .page-head h1 { font-size: 1.4rem; }
    .dash-hero h1 { font-size: 1.5rem; }
}
@media (max-width: 480px) { .login-keypad button { min-height: 50px; } .pin-field input { font-size: 1.4rem !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
