:root {
  --ink: #14252b; --muted: #64767d; --line: #dbe4e7; --canvas: #f3f6f7; --card: #ffffff;
  --primary: #0f6b79; --primary-dark: #084c58; --primary-soft: #e5f2f3;
  --accent: #ea7b4a; --accent-soft: #fff0e9; --green: #24896a; --green-soft: #e6f5ef;
  --yellow: #a06d0c; --yellow-soft: #fff6d9; --red: #b5494b; --red-soft: #fdeced;
  --shadow: 0 16px 40px rgba(20, 47, 55, .08); --radius: 16px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; font-family: "Segoe UI", Tahoma, Arial, "Noto Sans Arabic", sans-serif; color: var(--ink); background: var(--canvas); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ltr { direction: ltr; }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; }

/* Login & setup */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; background: white; }
.login-art { min-height: 100vh; position: relative; overflow: hidden; display: grid; place-items: center; padding: 60px; color: white; background: linear-gradient(145deg, #072f38, #0d6876 58%, #19889a); }
.login-art::before { content: ""; position: absolute; width: 680px; height: 680px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; inset: -260px auto auto -180px; box-shadow: 0 0 0 90px rgba(255,255,255,.025), 0 0 0 180px rgba(255,255,255,.018); }
.login-art::after { content: "✈"; position: absolute; font-size: 290px; opacity: .05; transform: rotate(-18deg); inset: auto 2% -11% auto; }
.login-art-content { position: relative; z-index: 1; max-width: 560px; }
.login-art .eyebrow { color: #9de0e8; }
.login-art h1 { font-size: clamp(36px, 4.5vw, 60px); line-height: 1.2; margin: 14px 0; }
.login-art p:not(.eyebrow) { font-size: 17px; line-height: 1.8; color: #d7eff2; }
.login-card { align-self: center; width: min(440px, calc(100% - 48px)); margin: auto; padding: 38px; position: relative; }
.login-card h2 { font-size: 30px; margin: 0 0 8px; }
.login-card > label { display: grid; gap: 8px; margin-top: 20px; font-weight: 700; font-size: 13px; }
.login-card input, .field input, .field select, .field textarea, .filter-control, .restore-box input[type=file], .actions input[type=file] { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); padding: 11px 13px; outline: none; transition: .2s; }
.login-card input:focus, .field input:focus, .field select:focus, .field textarea:focus, .filter-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,107,121,.11); }
.login-card .language-pill { position: absolute; inset: 0 auto auto 0; }
.version-note { margin-top: 20px; color: var(--muted); font-size: 11px; text-align: center; }
.mobile-brand { display: none; align-items: center; gap: 12px; margin-bottom: 30px; }
.mobile-brand .brand-mark { box-shadow: 0 0 0 1px var(--line); }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: white; padding: 5px; box-shadow: 0 4px 12px rgba(0,0,0,.18); flex: 0 0 auto; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-mark.large { width: 84px; height: 84px; border-radius: 20px; padding: 9px; box-shadow: 0 14px 30px rgba(0,0,0,.18); }
.login-logo { display: block; width: min(300px, 70%); margin: 0 auto 8px; }

/* Shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 272px 1fr; }
.sidebar { direction: rtl; height: 100vh; position: sticky; top: 0; color: #dcebed; background: linear-gradient(180deg, #092f38, #0b4652); padding: 18px 12px; display: flex; flex-direction: column; z-index: 20; }
.sidebar-brand { display: flex; direction: ltr; align-items: center; gap: 12px; padding: 2px 9px 18px; color: white; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand small { color: #92bec5; margin-top: 3px; font-size: 11px; }
.sidebar nav { overflow-y: auto; padding-inline: 2px; scrollbar-width: thin; }
.nav-label { display: flex; align-items: center; gap: 8px; color: #f3c37a; font-size: 13.5px; font-weight: 900; letter-spacing: .2px; margin: 20px 6px 8px; padding: 0 6px 6px; border-bottom: 1px solid rgba(243,195,122,.28); }
.nav-label::before { content: ""; width: 4px; height: 15px; border-radius: 3px; background: #f3c37a; flex: 0 0 auto; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; color: #cce0e3; background: transparent; padding: 9px 12px; border-radius: 9px; text-align: start; margin: 1px 0; transition: .16s; font-size: 14px; font-weight: 600; }
.nav-item:hover { background: rgba(255,255,255,.07); color: white; }
.nav-item.active { background: white; color: var(--primary-dark); font-weight: 800; box-shadow: 0 10px 20px rgba(0,0,0,.12); }
.nav-item b { margin-inline-start: auto; min-width: 22px; height: 20px; display: grid; place-items: center; border-radius: 7px; color: white; background: var(--accent); font-size: 11px; padding: 0 5px; }
.nav-item b:empty { display: none; }
.nav-icon { width: 20px; text-align: center; font-size: 17px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 14px 10px 2px; display: flex; align-items: center; gap: 8px; color: #96c0c6; font-size: 11px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #5dd39e; box-shadow: 0 0 0 5px rgba(93,211,158,.12); }
.main-column { min-width: 0; direction: rtl; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 26px; background: rgba(255,255,255,.93); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 15; backdrop-filter: blur(14px); }
.topbar-title p { margin: 0; color: var(--muted); font-size: 11px; }
.topbar-title h1 { margin: 3px 0 0; font-size: 20px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; position: relative; }
.language-pill, .icon-button { min-width: 38px; height: 38px; border: 1px solid var(--line); background: white; color: var(--primary); border-radius: 10px; font-weight: 800; }
.notification-button { position: relative; }
.notification-button span { position: absolute; inset: -6px -6px auto auto; background: var(--accent); color: white; border-radius: 8px; min-width: 18px; padding: 2px 5px; font-size: 9px; }
.profile-button { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; color: var(--ink); text-align: start; padding: 4px; }
.profile-button strong, .profile-button small { display: block; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-button small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.avatar { width: 36px; height: 36px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 900; font-size: 12px; }
.profile-menu { position: absolute; top: 48px; inset-inline-end: 0; background: white; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 190px; z-index: 30; }
.profile-menu button { width: 100%; background: transparent; border: 0; padding: 10px; color: var(--ink); text-align: start; border-radius: 7px; }
.profile-menu button:hover { background: var(--canvas); }
.profile-menu .danger-text { color: var(--red); }

main { padding: 24px 26px 60px; max-width: 1700px; margin: auto; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 24px; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions.end { justify-content: end; margin-top: 12px; }
.actions.wrap input[type=file] { width: auto; }
.button { border: 0; border-radius: 9px; padding: 10px 15px; font-weight: 800; color: var(--ink); background: #e8edef; transition: .15s; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; }
.button:hover { filter: brightness(.97); }
.button.primary { background: var(--primary); color: white; box-shadow: 0 8px 16px rgba(15,107,121,.17); }
.button.secondary { background: var(--primary-soft); color: var(--primary); }
.button.danger { background: var(--red-soft); color: var(--red); }
.button.success { background: var(--green); color: white; }
.button.ghost { background: white; border: 1px solid var(--line); }
.button.small { padding: 6px 9px; font-size: 11px; border-radius: 7px; }
.button.wide { width: 100%; margin-top: 22px; justify-content: center; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.link-button { border: 0; background: transparent; color: var(--primary); font-weight: 700; text-decoration: underline; padding: 0; }
.hint-line { margin: 0 0 14px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stats-grid.two { grid-template-columns: repeat(2, minmax(180px, 300px)); }
.stat-card { position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; min-height: 112px; box-shadow: 0 7px 24px rgba(27,64,74,.04); }
.stat-card[role=button] { cursor: pointer; }
.stat-card[role=button]:hover { border-color: #aacbd0; }
.stat-card::after { content: ""; width: 70px; height: 70px; border-radius: 50%; position: absolute; top: -28px; inset-inline-end: -22px; background: var(--primary-soft); opacity: .55; z-index: 0; pointer-events: none; }
.stat-card > * { position: relative; z-index: 1; }
.stat-card.orange::after { background: var(--accent-soft); }
.stat-card.green::after { background: var(--green-soft); }
.stat-card .stat-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); font-size: 14px; }
.stat-card strong { font-size: 26px; display: block; margin-top: 10px; letter-spacing: -.5px; }
.stat-card small { color: var(--muted); font-weight: 650; }
.content-grid { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(280px,.7fr); gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(27,64,74,.04); overflow: hidden; margin-bottom: 16px; }
.card.padded { padding: 18px 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fafcfc; }
.card-header h3 { margin: 0; font-size: 15px; }
.card-body { padding: 16px 18px; }
.table-wrap { overflow: auto; }
.table-wrap.tall { max-height: 60vh; }
.table-wrap.tall thead th { position: sticky; top: 0; z-index: 1; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 10px 12px; text-align: start; color: var(--muted); font-size: 11px; letter-spacing: .2px; background: #f4f7f8; border-bottom: 1px solid var(--line); font-weight: 800; }
td { padding: 10px 12px; border-bottom: 1px solid #edf1f2; font-size: 13px; vertical-align: middle; }
table.dense td { padding: 7px 10px; font-size: 12px; }
td.num { direction: ltr; text-align: end; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #fafcfc; }
tbody tr:last-child td { border-bottom: 0; }
tr.inactive-row td { color: var(--muted); background: #fbfbfb; }
tr.saved-row td { background: var(--green-soft); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; display: inline-block; unicode-bidi: isolate; }
.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 9px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.draft { color: #66757b; background: #eef2f3; }
.status.ops_review { color: #3f668f; background: #e7f0fa; }
.status.submitted { color: var(--yellow); background: var(--yellow-soft); }
.status.returned, .status.cancelled { color: var(--red); background: var(--red-soft); }
.status.approved { color: var(--green); background: var(--green-soft); }
.status.invoiced, .status.issued { color: var(--primary); background: var(--primary-soft); }
.status.open { color: var(--green); background: var(--green-soft); }
.status.archived { color: #67599a; background: #eeebfb; }
.filters { display: grid; grid-template-columns: 1.5fr repeat(3, minmax(130px,.7fr)); gap: 10px; margin-bottom: 14px; align-items: end; }
.filters.five { grid-template-columns: 1.4fr 1fr 1fr 1fr auto; }
.filter-control.static { background: #f7fafa; color: var(--muted); }
.search-field { position: relative; }
.search-field input { padding-inline-start: 36px; }
.search-field::before { content: "⌕"; position: absolute; inset-inline-start: 12px; top: 9px; color: var(--muted); font-size: 16px; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty-state b { color: var(--ink); display: block; font-size: 15px; margin-bottom: 6px; }
.progress-list { display: grid; gap: 13px; }
.progress-item { display: grid; grid-template-columns: 130px 1fr 42px; gap: 10px; align-items: center; font-size: 11px; }
.progress-track { height: 8px; background: #eaf0f1; border-radius: 999px; overflow: hidden; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #22a1b2); }
.review-stack { display: grid; gap: 12px; }
.review-card { border: 1px solid var(--line); border-radius: 14px; background: white; padding: 16px; display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.review-card h3 { margin: 0 0 6px; font-size: 15px; }
.review-card p { margin: 3px 0; color: var(--muted); font-size: 12px; }
.metric-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.metric { padding: 6px 9px; border-radius: 8px; background: #f2f6f7; font-size: 11px; }
.queue-count { min-width: 32px; height: 28px; padding: 0 9px; display: grid; place-items: center; border-radius: 8px; color: white; background: var(--primary); font-size: 12px; font-weight: 900; }
.category-count { min-width: 32px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--primary-dark); background: white; border: 1px solid var(--line); font-size: 12px; font-weight: 900; }
.price { font-weight: 900; color: var(--primary-dark); white-space: nowrap; }
.category-label { padding: 3px 7px; background: #eef3f4; border-radius: 6px; font-size: 10px; color: var(--muted); white-space: nowrap; }
.product-airline-grid { display: grid; grid-template-columns: repeat(3,minmax(240px,1fr)); gap: 14px; }
.product-airline-folder { appearance: none; width: 100%; padding: 18px; color: var(--ink); font: inherit; text-align: start; cursor: pointer; transition: transform .16s, border-color .16s, box-shadow .16s; margin: 0; }
.product-airline-folder:hover { transform: translateY(-3px); border-color: #aacbd0; box-shadow: 0 18px 38px rgba(15,107,121,.11); }
.product-folder-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.airline-code { min-width: 44px; height: 44px; padding: 0 8px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-weight: 900; }
.airline-code.small { min-width: 36px; height: 32px; font-size: 11px; border-radius: 9px; }
.airline-logo { display: block; height: 44px; max-width: 150px; object-fit: contain; background: white; border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px; }
.airline-logo.small { height: 34px; max-width: 110px; }
.airline-logo.folder { height: 52px; max-width: 170px; }
.logo-field { grid-column: 1 / -1; display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; align-items: start; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fbfdfd; }
.logo-preview { min-height: 90px; display: grid; place-items: center; background: white; border: 1px dashed var(--line); border-radius: 10px; padding: 8px; }
.logo-preview img { max-width: 100%; max-height: 110px; object-fit: contain; }
.logo-controls .field { margin: 0; }
.logo-controls .button { margin-top: 8px; }
.folder-arrow { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); font-size: 16px; font-weight: 900; }
.product-airline-folder h3 { margin: 14px 0 4px; font-size: 17px; }
.product-airline-folder > p { margin: 0; color: var(--muted); font-size: 12px; }
.product-folder-counts { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; margin: 14px 0; }
.product-folder-counts span { min-width: 0; padding: 8px 4px; border-radius: 9px; background: #f5f8f8; text-align: center; }
.product-folder-counts b, .product-folder-counts small { display: block; }
.product-folder-counts b { color: var(--primary-dark); font-size: 15px; }
.product-folder-counts small { margin-top: 2px; color: var(--muted); font-size: 10px; white-space: normal; }
.folder-open { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 12px; border-radius: 8px; color: white; background: var(--primary); font-size: 12px; font-weight: 850; }
.product-category-card .card-header { background: linear-gradient(90deg,var(--primary-soft),white); }
.report-toolbar { display: grid; grid-template-columns: repeat(3,minmax(130px,1fr)) repeat(2,minmax(140px,.8fr)) auto auto; align-items: end; gap: 10px; margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.report-title { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.report-title h3, .report-title p { margin: 0; }
.invoice-sections { display: grid; gap: 4px; }
.stacked-card-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.permission-count { display: inline-grid; min-width: 30px; min-height: 26px; padding: 3px 8px; place-items: center; border-radius: 8px; color: var(--primary-dark); background: var(--primary-soft); font-weight: 900; font-size: 12px; }
.permission-panel { margin-top: 18px; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.permission-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 14px; background: #f5f9f9; border-bottom: 1px solid var(--line); }
.permission-head b, .permission-head span { display: block; }
.permission-head > div > span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.permission-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1px; background: var(--line); }
.permission-option { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 10px 14px; background: white; font-size: 12px; font-weight: 700; cursor: pointer; }
.permission-option input, .check-field input { width: 18px; height: 18px; accent-color: var(--primary); flex: 0 0 auto; }
.manager-access-note { display: grid; gap: 5px; padding: 14px; color: var(--primary-dark); background: var(--primary-soft); }
.manager-access-note span, .field-help { color: var(--muted); font-size: 12px; }
.field-help { margin: 12px 0 0; }
.check-field { display: flex; align-items: center; gap: 9px; align-self: end; min-height: 42px; font-size: 12px; font-weight: 800; }
.check-field.inline { min-height: auto; padding: 8px 4px; }
.readonly-field { display: grid; gap: 7px; }
.readonly-field > span { font-size: 12px; font-weight: 800; }
.readonly-field > strong { min-height: 43px; display: flex; align-items: center; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; background: #f5f8f8; }
.warning-list { margin: 8px 0 0; padding-inline-start: 18px; color: var(--yellow); font-size: 12px; max-height: 240px; overflow: auto; }
.restore-box h3 { margin: 0 0 10px; font-size: 15px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(3,25,30,.6); padding: 22px; backdrop-filter: blur(3px); }
.modal { width: min(980px, 100%); max-height: calc(100vh - 44px); overflow: auto; background: white; border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.28); display: flex; flex-direction: column; }
.modal.wide { width: min(1280px, 100%); }
.modal.medium { width: min(780px, 100%); }
.modal.small { width: min(480px, 100%); }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 22px; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-close { border: 0; background: #eef3f4; width: 32px; height: 32px; border-radius: 9px; font-size: 18px; }
.modal-body { padding: 20px 22px; }
.modal-footer { position: sticky; bottom: 0; display: flex; justify-content: end; gap: 8px; padding: 14px 22px; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); flex-wrap: wrap; }
.confirm-text { font-size: 15px; margin: 0; line-height: 1.7; }
.form-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.form-grid.one { grid-template-columns: 1fr; }
.field { display: grid; gap: 6px; font-size: 12px; font-weight: 800; align-content: start; }
.field.full { grid-column: 1 / -1; }
.products-editor { margin-top: 18px; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.products-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: #f7fafa; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.product-section td { background: #eaf2f3; color: var(--primary-dark); font-weight: 900; padding: 8px 12px; }
.qty-input, .returned-input, .discount-input, .price-input { width: 96px; border: 1px solid var(--line); border-radius: 8px; padding: 7px; text-align: center; direction: ltr; }
.note-input { width: 180px; border: 1px solid var(--line); border-radius: 8px; padding: 7px; }
.price-from, .price-to { border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.order-editor td { padding: 6px 10px; }
.order-summary { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin: 0 0 16px; }
.summary-box { background: #f3f7f8; border-radius: 10px; padding: 10px 12px; }
.summary-box small, .summary-box strong { display: block; }
.summary-box small { color: var(--muted); font-size: 10px; margin-bottom: 4px; }
.summary-box strong { font-size: 13px; }
.comment-box { border-inline-start: 4px solid var(--accent); background: var(--accent-soft); color: #714228; padding: 12px; border-radius: 9px; margin-bottom: 14px; font-size: 13px; }
.comment-box.neutral { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.consumed-value { font-weight: 800; color: var(--green); }
.consumed-value.invalid, td.invalid { color: var(--red); font-weight: 800; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 18px; justify-content: center; border-top: 1px solid var(--line); }
.pager-item { border: 1px solid var(--line); background: white; border-radius: 8px; min-width: 34px; padding: 6px 10px; font-weight: 700; }
.pager-item.active { background: var(--primary); color: white; border-color: var(--primary); }
.pager-item:disabled { opacity: .4; cursor: default; }
.pager-gap { padding: 6px 4px; color: var(--muted); }
.toast-region { position: fixed; z-index: 999; inset: 18px auto auto 18px; display: grid; gap: 8px; }
.toast { min-width: 260px; max-width: 430px; padding: 13px 15px; border-radius: 11px; color: white; background: var(--primary-dark); box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.toast.error { background: var(--red); }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } }
.mobile-only { display: none; }

html[dir="ltr"] .sidebar, html[dir="ltr"] .main-column, html[dir="ltr"] .login-screen { direction: ltr; }

@media (max-width: 1150px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .product-airline-grid { grid-template-columns: repeat(2,1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .report-toolbar { grid-template-columns: repeat(3,1fr); }
  .filters, .filters.five { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 820px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .mobile-brand { display: flex; }
  .login-card { padding: 30px 0; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-105%); transition: .2s; box-shadow: var(--shadow); }
  html[dir="rtl"] .sidebar { inset: 0 0 0 auto; transform: translateX(105%); }
  .sidebar.open { transform: translateX(0) !important; }
  .mobile-only { display: grid; place-items: center; }
  .topbar { padding: 0 14px; height: 64px; }
  .topbar-title p { display: none; }
  .topbar-title h1 { font-size: 16px; }
  .profile-button > span:not(.avatar) { display: none; }
  main { padding: 18px 12px 45px; }
  .page-head { align-items: start; flex-direction: column; }
  .stats-grid, .stats-grid.two { grid-template-columns: repeat(2,1fr); }
  .filters, .filters.five, .form-grid { grid-template-columns: 1fr; }
  .product-airline-grid { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 8px; }
  .modal { max-height: calc(100vh - 16px); border-radius: 14px; }
  .order-summary { grid-template-columns: repeat(2,1fr); }
  .permission-grid { grid-template-columns: 1fr; }
  .review-card { grid-template-columns: 1fr; }
  .report-toolbar { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid, .stats-grid.two { grid-template-columns: 1fr; }
  .topbar-actions { gap: 4px; }
  .notification-button { display: none; }
}
@media print {
  body { background: white; }
  .sidebar, .topbar, .page-head .actions, .filters, .report-toolbar, .toast-region, .pager { display: none !important; }
  .app-shell { display: block; }
  main { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; }
}

/* Finance review: discounts and totals */
.review-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); background: #fafcfc; }
.bulk-discount { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bulk-discount select, .bulk-discount input { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.bulk-discount input { width: 110px; direction: ltr; text-align: center; }
.bulk-discount small { flex-basis: 100%; }
.totals { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.totals b { font-variant-numeric: tabular-nums; }
.review-table .discount-input { width: 96px; }
.review-table .mode-input { border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.field-help.full { grid-column: 1 / -1; margin: 0; }
.legacy-box h3 { margin: 0 0 6px; font-size: 16px; }
.legacy-progress { margin-top: 14px; }
.legacy-progress .progress-track { height: 10px; }
.legacy-progress p { margin: 8px 0 0; font-size: 13px; }

.section-title { font-size: 14px; margin: 18px 0 8px; color: var(--primary-dark); }

.test-banner { position: sticky; top: 0; z-index: 60; background: #b45309; color: #fff; text-align: center; font-weight: 800; font-size: 13px; padding: 7px 12px; }
.secret-input { -webkit-text-security: disc; font-family: monospace; }
.test-banner button { margin-inline-start: 12px; border: 0; border-radius: 6px; background: #fff; color: #7c2d12; font: inherit; font-size: 12px; padding: 3px 10px; cursor: pointer; }

/* Staff affairs */
.notice-text { white-space: pre-wrap; line-height: 1.9; font-size: 13.5px; background: #f7f8fa; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; font-family: Arial, Tahoma, sans-serif; }
.notice-editor { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font: 13.5px/1.9 Arial, Tahoma, sans-serif; color: var(--ink); resize: vertical; }
.notice-editor:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(15,107,121,.11); }
.hr-preview { margin: 16px 0; padding: 14px 16px; border: 1px dashed #b5c5c9; border-radius: 12px; background: #fbfdfd; }
.hr-preview .order-summary { margin-bottom: 8px; }
.prior-list { margin: 4px 0 0; padding-inline-start: 18px; font-size: 12px; }
.prior-list li { margin: 3px 0; }
.ladder-editor td, .ladder-editor th { padding: 8px 10px; }
.ladder-editor input, .ladder-editor select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.day-group { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.day-group label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.flag { display: inline-block; margin: 1px 2px; padding: 3px 7px; border-radius: 7px; font-size: 10.5px; font-weight: 800; background: #eef2f3; color: #4c5b60; }
.flag.late, .flag.absent, .flag.early_leave { background: var(--red-soft); color: var(--red); }
.flag.wrong_shift, .flag.missing_punch, .flag.worked_off_day { background: var(--yellow-soft); color: var(--yellow); }
.flag.overtime { background: var(--green-soft); color: var(--green); }
.alert-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.alert-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--yellow-soft); font-size: 12.5px; font-weight: 700; }
.alert-list li.info { background: #eef2f3; }
.alert-list li.danger { background: var(--red-soft); }
.upload-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.upload-box input[type=file] { flex: 1 1 320px; }

.group-row td { background: var(--primary-dark, #0f6978); color: #fff; font-weight: 800; font-size: 13px; padding: 9px 12px; }
.group-row td .count, .subgroup-row td .count { display: inline-grid; place-items: center; min-width: 24px; height: 20px; padding: 0 6px; margin-inline-start: 8px; border-radius: 7px; background: rgba(255,255,255,.22); font-size: 11px; }
.subgroup-row td { background: #eef4f5; color: var(--primary-dark, #0f6978); font-weight: 800; font-size: 12px; padding: 7px 12px 7px 24px; }
.subgroup-row td .count { background: rgba(15,105,120,.12); }
tbody tr.group-row:hover td, tbody tr.subgroup-row:hover td { background-color: inherit; }

.link-button.strong { font-weight: 800; font-size: 13px; }
tbody tr.selected-row td { background: var(--primary-soft); }

.station-input { width: 90px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; text-align: center; direction: ltr; text-transform: uppercase; }
.station-input.station-empty { border: 2px solid #d97706; background: #fff7ed; }
.search-hidden { display: none !important; }
.list-search-bar { grid-template-columns: minmax(220px, 420px) auto; margin-bottom: 14px; }
.modal .list-search-bar { margin-bottom: 10px; }

/* Equipment department */
.equip-photo { display: inline-grid; place-items: center; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #f6f8f8; color: var(--muted); }
.equip-photo.small { width: 42px; height: 42px; }
.equip-photo.large { width: 150px; height: 150px; flex: 0 0 auto; }
.equip-photo.empty { font-size: 18px; }
.equip-card { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 16px; }
.equip-card h3 { margin: 0 0 4px; }
td.num { text-align: center; direction: ltr; }
td.loss { color: #b42318; font-weight: 700; }
.negative { color: #b42318; }
.equip-lines .qty-input { width: 72px; }
.equip-lines .note-input { width: 130px; }
tr.line-error td { background: #fff1f0; }
tr.line-error .eq-shortage { color: #b42318; font-weight: 800; }

.attach-upload { display: flex; align-items: center; gap: 12px; margin: 10px 0 14px; }
.attach-upload label.button { cursor: pointer; }
.attach-list { display: grid; gap: 10px; }
.attach-tile { display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: white; }
.attach-tile img { width: 110px; height: 80px; object-fit: cover; border-radius: 8px; display: block; }
.attach-tile b, .attach-tile small { display: block; }
.attach-pdf { width: 110px; height: 80px; display: grid; place-items: center; border-radius: 8px; background: #fde8e8; color: #b42318; font-weight: 900; }
.attach-missing { color: #d97706; font-weight: 800; }

.scan-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 12px; padding: 10px 12px; border: 1px dashed var(--primary); border-radius: 12px; background: #f3fafb; }
.scan-box label.button { cursor: pointer; }
.qty-input.ai-filled { background: #fff8db; border-color: #e0b400; }
.qty-input.ai-unclear { background: #ffe8d6; border-color: #d97706; border-width: 2px; }

/* A table cell must stay a table cell even when it carries an inline style class such as .mono;
   otherwise the browser merges it with the next cell and every column after it shifts. */
td.mono, th.mono, td.status, td.num { display: table-cell; }

tr.total-row td { background: #f1f5f6; font-weight: 800; border-top: 2px solid var(--line); }

/* Finance review: products not on the order are listed dimmed until a quantity is added. */
.review-table tr.zero-row td { opacity: .55; }
.review-table tr.zero-row td input { opacity: 1; }
.review-table tr.zero-row:hover td, .review-table tr.zero-row:focus-within td { opacity: 1; }

/* Supply order form: compact one-line product rows so many more fit on screen (user request 2026-10-20). */
.table-wrap.order-products { max-height: calc(100vh - 330px); min-height: 320px; }
.order-editor td { padding: 1px 8px; font-size: 12.5px; line-height: 1.2; }
.order-editor td small { font-size: 11px; }
.order-editor td.type-cell { color: var(--muted); font-size: 11.5px; }
.order-editor tbody tr:nth-child(even):not(.product-section) td { background: #fafcfc; }
.order-editor tbody tr:focus-within td { background: #fff4d6 !important; }
.order-editor tbody tr.has-qty td { background: #eef8f1; }
.order-editor tbody tr.has-qty strong { color: var(--primary-dark); }
.order-editor .product-section td { padding: 4px 10px; font-size: 12.5px; }
.order-editor .qty-input { width: 78px; height: 23px; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.order-editor thead th { padding: 6px 8px; }
.form-grid.order-head { grid-template-columns: 1.1fr 1.6fr 1.2fr .5fr; gap: 10px; margin-bottom: 10px; }
.form-grid.order-head .field > span { font-size: 11.5px; margin-bottom: 2px; }
.form-grid.order-head select, .form-grid.order-head input { padding-top: 6px; padding-bottom: 6px; }
.products-editor .products-toolbar .link-button { font-size: 12px; }
@media (max-width: 760px) { .form-grid.order-head { grid-template-columns: 1fr 1fr; } }
.table-wrap.order-products { max-height: calc(100vh - 250px); }
/* Invoice aggregation row icons */
td.row-icons { display: table-cell; }
.icon-link { display: inline-block; padding: 2px 7px; margin-inline-start: 4px; border: 1px solid var(--line); border-radius: 6px; font-size: 11.5px; font-weight: 700; color: var(--primary-dark); text-decoration: none; background: #fff; }
.icon-link:hover { background: #eaf2f3; }
/* Fleet screens settings */
pre.code-line { direction: ltr; text-align: left; background: #0f2a30; color: #d6f1f4; padding: 10px 12px; border-radius: 8px; font-size: 12px; white-space: pre-wrap; word-break: break-all; }

/* ---------- Phones and tablets ----------
   Touch screens only (hover: none, pointer: coarse): a PC keeps its layout at any window size. */
.bottom-nav { display: none; }
@media (max-width: 820px) and (hover: none) and (pointer: coarse) {
  /* The login page shows the full logo once. */
  .login-card .mobile-brand { display: none; }
  /* Bottom bar with the screens this role uses most; the full menu stays behind ☰. */
  .bottom-nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; inset: auto 0 0 0; z-index: 40; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px)); backdrop-filter: blur(14px); box-shadow: 0 -6px 20px rgba(20,47,55,.06); }
  .bottom-item { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 54px; border: 0; background: transparent; color: var(--muted); border-radius: 10px; padding: 4px 2px; font-size: 10.5px; font-weight: 700; }
  .bottom-item .nav-icon { font-size: 19px; width: auto; }
  .bottom-item.active { color: var(--primary-dark); background: var(--primary-soft); }
  .bottom-label { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-align: center; line-height: 1.2; max-width: 100%; }
  .bottom-item b { position: absolute; top: 3px; inset-inline-end: calc(50% - 22px); min-width: 18px; height: 17px; display: grid; place-items: center; border-radius: 9px; color: white; background: var(--accent); font-size: 10px; padding: 0 4px; }
  .bottom-item b:empty { display: none; }
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .sidebar { z-index: 60; overflow-y: auto; }

  /* Dashboard: two compact tiles a row, the work waiting first. */
  .stats-grid, .stats-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { min-height: 0; padding: 12px 13px; border-radius: 12px; }
  .stat-card::after { width: 46px; height: 46px; top: -20px; inset-inline-end: -16px; }
  .stat-card .stat-icon { width: 26px; height: 26px; font-size: 12px; border-radius: 8px; }
  .stat-card strong { font-size: 20px; margin-top: 6px; overflow-wrap: anywhere; }
  .stat-card small { font-size: 11.5px; line-height: 1.3; display: block; }
  .dashboard-grid { display: flex; flex-direction: column; gap: 0; }
  .dashboard-grid > .card:nth-child(2) { order: -1; }

  /* Pop-up windows fill the screen; their save buttons stay at the bottom. */
  .modal-backdrop { padding: 0; place-items: stretch; }
  .modal, .modal.wide, .modal.medium, .modal.small { width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .modal-header { padding: 12px 14px; }
  .modal-body { padding: 14px 12px; }
  .modal-footer { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .modal-footer .button { flex: 1 1 auto; justify-content: center; }
  .modal-footer .modal-close-footer { display: none; }
  .modal-footer .button { min-height: 42px; padding: 8px 10px; font-size: 13px; }

  /* Touch: fingers need bigger targets, and 16px text keeps iPhones from zooming into fields. */
  input, select, textarea, .filter-control { font-size: 16px !important; }
  .field input, .field select, .filter-control, .login-card input { min-height: 46px; }
  .button { min-height: 44px; padding: 10px 14px; }
  .button.small { min-height: 36px; padding: 7px 11px; font-size: 12.5px; }
  .icon-button, .language-pill { min-width: 42px; height: 42px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  .page-head .actions, .page-head > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
  .page-head .actions .button { flex: 1 1 auto; justify-content: center; }

  /* Supply-order products: one line each (name and quantity); type and code are hidden. */
  .table-wrap.order-products { max-height: none; min-height: 0; overflow: visible; }
  .order-products .order-editor { white-space: normal; }
  .order-products .order-editor thead { display: none; }
  .order-products .order-editor td.type-cell, .order-products .order-editor tr[data-product-row] td:nth-child(3) { display: none; }
  .order-products .order-editor td { padding: 6px 8px; font-size: 14px; line-height: 1.3; }
  .order-products .order-editor tr[data-product-row] td:last-child { width: 1%; }
  .order-products .order-editor .qty-input { width: 86px; height: 42px; font-size: 17px !important; text-align: center; }
  .order-products .order-editor .product-section td { position: sticky; top: 0; z-index: 1; background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; }
}
@media (max-width: 1024px) and (hover: none) and (pointer: coarse) {
  /* Phones and tablets: every list row becomes a card: the first column as its title, the others as name/value pairs, the buttons at the bottom. */
  :is(#mainContent, #modalRoot) .table-wrap { overflow: visible; max-height: none; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) { display: block; white-space: normal; border: 0; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) thead { display: none; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) :is(tbody, tfoot) { display: grid; gap: 10px; padding: 10px; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 9px 14px; padding: 12px 14px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 3px 10px rgba(27,64,74,.04); }
  :is(#mainContent, #modalRoot) table:not(.keep-table) tr.hidden { display: none !important; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; text-align: start; font-size: 13.5px; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) tr:not(.row-full) td { background: transparent !important; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) td::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--muted); font-size: 10.5px; font-weight: 800; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) td[data-label=""]::before { display: none; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) td:first-child { grid-column: 1 / -1; font-size: 15px; font-weight: 800; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) td:first-child::before { display: none; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) td.cell-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
  :is(#mainContent, #modalRoot) table:not(.keep-table) td.cell-actions::before { display: none; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) td.cell-actions .button { flex: 1 1 auto; justify-content: center; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) td input:not([type=checkbox]):not([type=radio]), :is(#mainContent, #modalRoot) table:not(.keep-table) td select { width: 100% !important; min-height: 42px; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) tr.row-full { display: block; padding: 0; overflow: hidden; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) tr.row-full td { padding: 9px 12px; font-size: 14px; }
  :is(#mainContent, #modalRoot) table:not(.keep-table) tr.row-full td::before { display: none; }
  /* Returns review and similar: the product is the card title, the type a small label. */
  :is(#mainContent, #modalRoot) table:is(.review-table, .price-table):not(.keep-table) td:nth-child(2) { grid-column: 1 / -1; order: -1; font-size: 15px; font-weight: 800; }
  :is(#mainContent, #modalRoot) table:is(.review-table, .price-table):not(.keep-table) td:nth-child(2)::before { display: none; }
  :is(#mainContent, #modalRoot) table:is(.review-table, .price-table):not(.keep-table) td:first-child { grid-column: auto; font-size: 13.5px; font-weight: 400; }
  :is(#mainContent, #modalRoot) table:is(.review-table, .price-table):not(.keep-table) td:first-child::before { display: block; }
  .card > .table-wrap, .card .table-wrap { background: #f6f9fa; }
}

/* Attendance months, monthly variables, violation attachments */
.month-row td { background: var(--surface-2, #eef5f6); font-weight: 700; }
.month-row.selected-row td { background: #dff0f2; }
tr.mv-sick td { background: #fde9a9; }
tr.mv-open td { background: #fbd3b0; }
.attachment-list { list-style: none; margin: 6px 0 12px; padding: 0 4px; }
.attachment-list li { padding: 5px 0; border-bottom: 1px solid var(--line, #e3e8ea); }
.attachment-list li:last-child { border-bottom: 0; }
.mv-note { width: 100%; min-width: 140px; padding: 4px 6px; border: 1px solid var(--line, #dbe4e7); border-radius: 6px; font: inherit; font-size: 12px; background: #fff; }
.mv-note.saved { border-color: #2e9e6a; box-shadow: 0 0 0 2px rgba(46,158,106,.15); }
.odoo-badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1.5; white-space: nowrap; vertical-align: middle; color: #fff; background: #714b67; }
.odoo-badge.posted { background: #1f8a5b; }
.odoo-badge.cancel, .odoo-badge.deleted { background: #c0392b; }
td:has(> .odoo-badge) { white-space: nowrap; }
.odoo-list td { padding-top: 5px; padding-bottom: 5px; }
.odoo-list tr.odoo-group td { background: var(--canvas); padding-top: 8px; padding-bottom: 8px; border-top: 2px solid var(--line, #dfe6ea); }
.odoo-row-note { font-size: 12px; color: #b4541f; white-space: normal; min-width: 220px; max-width: 380px; }

/* ---------- Chat (المحادثات): list of conversations + the open conversation; phones show one at a time ---------- */
.chat-button { position: relative; }
.chat-button span { position: absolute; inset: -6px -6px auto auto; background: var(--accent); color: white; border-radius: 8px; min-width: 18px; padding: 2px 5px; font-size: 9px; }
.view-chat main { padding-bottom: 16px; }
.chat-shell { display: grid; grid-template-columns: 330px minmax(0, 1fr); height: calc(100vh - 112px); min-height: 440px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 28px rgba(27,64,74,.04); }
.chat-list { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--line); background: #fafcfc; }
.chat-list-head { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.chat-list-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-all { font-size: 12px; color: var(--muted); }
.chat-threads { overflow-y: auto; flex: 1; }
.chat-thread { width: 100%; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 0; border-bottom: 1px solid #edf1f2; background: transparent; text-align: start; color: var(--ink); }
.chat-thread:hover { background: #f1f6f7; }
.chat-thread.active { background: var(--primary-soft); }
.chat-thread.archived { opacity: .6; }
.chat-thread-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-thread-top { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.chat-thread-top b { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.chat-thread-top small { color: var(--muted); font-size: 11px; flex: none; }
.chat-thread-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread.unread .chat-thread-top b, .chat-thread.unread .chat-thread-sub:last-child { color: var(--ink); font-weight: 800; }
.chat-unread { font-style: normal; min-width: 22px; height: 22px; display: grid; place-items: center; border-radius: 11px; background: var(--accent); color: white; font-size: 11px; font-weight: 800; padding: 0 6px; flex: none; }
.chat-eye { font-style: normal; opacity: .45; flex: none; }
.chat-avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 900; font-size: 13px; }
.chat-avatar.group { background: var(--accent-soft); color: var(--accent); font-size: 17px; }
.chat-avatar.order { background: var(--yellow-soft); color: var(--yellow); font-size: 18px; }
.chat-empty { padding: 30px 16px; text-align: center; color: var(--muted); }
.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: #edf3f4; }
.chat-pick { margin: auto; text-align: center; color: var(--muted); padding: 20px; }
.chat-pick span { font-size: 52px; opacity: .3; }
.chat-pane-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: white; border-bottom: 1px solid var(--line); }
.chat-back { display: none; }
.chat-pane-title { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-pane-title b { font-size: 15px; }
.chat-pane-title small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pane-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: end; }
.chat-messages { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.chat-day { text-align: center; margin: 10px 0 6px; }
.chat-day span { background: #dbe7e9; color: #4d636a; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
/* Mirrored like phone chat apps: my messages at the end side (left in Arabic, right in English). */
.chat-msg { display: flex; justify-content: flex-start; }
.chat-msg.mine { justify-content: flex-end; }
.chat-bubble { max-width: min(75%, 560px); padding: 7px 10px 5px; border-radius: 12px; background: white; box-shadow: 0 1px 1px rgba(0,0,0,.06); overflow-wrap: anywhere; }
.chat-msg.mine .chat-bubble { background: #d6f0ea; }
.chat-name { font-size: 11.5px; font-weight: 800; color: var(--primary); margin-bottom: 2px; }
.chat-text { line-height: 1.55; font-size: 14px; }
.chat-text a { color: var(--primary); }
.chat-meta { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 2px; color: var(--muted); font-size: 10.5px; direction: ltr; }
.chat-ticks { color: #8a9ba0; font-weight: 800; letter-spacing: -2px; }
.chat-ticks.seen { color: #2b8fd6; }
.chat-del { border: 0; background: transparent; padding: 0 2px; font-size: 11px; opacity: 0; }
.chat-msg:hover .chat-del, .chat-del:focus { opacity: .65; }
.chat-deleted { color: var(--muted); font-style: italic; font-size: 13px; }
.chat-image-link { display: block; }
.chat-image { display: block; max-width: 100%; max-height: 320px; border-radius: 8px; margin-bottom: 4px; }
.chat-file { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: rgba(15,107,121,.07); border-radius: 8px; color: var(--ink); text-decoration: none; margin-bottom: 4px; }
.chat-file b { display: block; font-size: 13px; overflow-wrap: anywhere; }
.chat-file small { color: var(--muted); font-size: 11px; }
.chat-file-icon { font-size: 22px; }
.chat-older { text-align: center; margin-bottom: 8px; }
.chat-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: white; border-top: 1px solid var(--line); }
.chat-composer textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 20px; padding: 10px 14px; max-height: 140px; outline: none; line-height: 1.4; background: white; color: var(--ink); }
.chat-composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,107,121,.11); }
.chat-attach { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; font-size: 19px; flex: none; color: var(--muted); }
.chat-attach:hover { background: var(--canvas); }
.chat-send { width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--primary); color: white; font-size: 17px; flex: none; }
html[dir="rtl"] .chat-send { transform: scaleX(-1); }
.chat-readonly { padding: 12px 16px; background: #fbfcfc; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 13px; }
.chat-contacts, .chat-members { display: grid; gap: 4px; max-height: 55vh; overflow-y: auto; }
.chat-contact { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: white; text-align: start; color: var(--ink); }
.chat-contact:hover { background: var(--primary-soft); }
.chat-contact b, .chat-contact small { display: block; }
.chat-contact small { color: var(--muted); font-size: 11.5px; }
.chat-member { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid #edf1f2; }
.chat-count-pill { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font-size: 11px; }
.chat-count-pill.unread { background: var(--accent); color: white; }
@media (max-width: 820px) {
  .chat-shell { grid-template-columns: 1fr; height: calc(100dvh - 64px - 30px); border-radius: 12px; min-height: 0; }
  .chat-shell.has-thread .chat-list { display: none; }
  .chat-shell:not(.has-thread) .chat-pane { display: none; }
  .chat-back { display: grid; place-items: center; flex: none; }
  .chat-bubble { max-width: 85%; }
  .chat-messages { padding: 10px; }
  .chat-pane-head { padding: 8px 10px; }
  .chat-pane-head .chat-avatar { width: 34px; height: 34px; }
}
@media (max-width: 820px) and (hover: none) and (pointer: coarse) {
  .view-chat main { padding: 8px 8px calc(70px + env(safe-area-inset-bottom, 0px)); }
  .chat-shell { height: calc(100dvh - 64px - 16px - 62px - env(safe-area-inset-bottom, 0px)); }
  .chat-del { opacity: .5; }
  .chat-pane-actions .button.small { min-height: 34px; padding: 6px 9px; }
}

/* Short TV address under each fleet screen's name (typed with a TV remote). */
.tv-address { margin-top: 4px; white-space: nowrap; }
.tv-address b { font-size: 1.05em; letter-spacing: .02em; color: var(--primary, #0d6b73); unicode-bidi: isolate; }

/* Quality control (مراقبة الجودة) */
.stat-card.red::after { background: var(--red-soft); opacity: 1; }
.stat-card.red strong { color: var(--red); }
.status.qc-analysis { color: #3f668f; background: #e7f0fa; }
.status.qc-approval, .status.qc-verify { color: var(--yellow); background: var(--yellow-soft); }
.status.qc-doing { color: var(--primary); background: var(--primary-soft); }
.status.qc-closed { color: var(--green); background: var(--green-soft); }
.status.qc-cancelled { color: #66757b; background: #eef2f3; }
.status.qc-audit-open, .status.qc-audit-reply_due { color: var(--yellow); background: var(--yellow-soft); }
.status.qc-audit-awaiting_airline { color: #3f668f; background: #e7f0fa; }
.status.qc-audit-closed { color: var(--green); background: var(--green-soft); }
.status.qc-audit-cancelled { color: #66757b; background: #eef2f3; }
.qc-due { white-space: nowrap; font-variant-numeric: tabular-nums; }
.qc-due.soon { color: var(--yellow); font-weight: 800; }
.qc-due.late { color: var(--red); font-weight: 800; }
tr.qc-row-late td:first-child { box-shadow: inset -3px 0 0 var(--red); }
[dir=ltr] tr.qc-row-late td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.qc-tabs { flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.filters.qc-filters { grid-template-columns: 1.6fr repeat(3, minmax(120px, .8fr)) repeat(2, minmax(120px, .6fr)); }
.qc-case-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 10px; }
.qc-case-head h2, .qc-case-head h3 { margin: 2px 0 6px; font-size: 18px; }
.qc-case-head h3 { font-size: 15px; }
.qc-case-head p { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qc-case-head .actions { flex-wrap: wrap; gap: 6px; }
.qc-stepper { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0; margin: 4px 0 14px; }
.qc-stepper li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #f1f5f6; color: var(--muted); font-size: 12px; font-weight: 700; }
.qc-stepper li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: white; border: 1px solid var(--line); font-size: 11px; flex: none; }
.qc-stepper li.done { background: var(--green-soft); color: var(--green); }
.qc-stepper li.done span { background: var(--green); color: white; border-color: var(--green); }
.qc-stepper li.now { background: var(--primary); color: white; }
.qc-stepper li.now span { color: var(--primary); }
.qc-step { border: 2px solid var(--primary); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; background: #f7fcfc; }
.qc-step.muted { border: 1px dashed var(--line); background: #fafcfc; }
.qc-step h3 { margin: 0 0 10px; font-size: 15px; color: var(--primary-dark); }
.qc-step .actions { margin-top: 10px; gap: 8px; }
.qc-radios { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 6px 0; }
.qc-radios label { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.qc-returned { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 8px 12px; margin: 0 0 10px; font-weight: 700; }
.qc-section { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.qc-section h3 { margin: 0 0 10px; font-size: 14px; }
.qc-text { white-space: pre-wrap; line-height: 1.7; margin: 0 0 10px; }
.qc-info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.qc-info { display: grid; gap: 2px; padding: 4px 0; }
.qc-info span { color: var(--muted); font-size: 11px; font-weight: 700; }
.qc-info b { font-weight: 600; white-space: pre-wrap; }
.qc-history { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.qc-history li { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; font-size: 13px; }
.qc-ev-icon { width: 26px; height: 26px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 12px; }
.qc-note { display: flex; gap: 8px; margin-bottom: 12px; }
.qc-note input { flex: 1; }
.qc-mine-list { display: grid; gap: 12px; }
.qc-mine-card.late { border-color: var(--red); box-shadow: inset 4px 0 0 var(--red); }
@media (max-width: 820px) {
  .qc-stepper { grid-template-columns: 1fr 1fr; }
  .filters.qc-filters { grid-template-columns: 1fr 1fr; }
  .filters.qc-filters .search-field { grid-column: 1 / -1; }
}
