/* Saif Plus Warehouse — design system
   Brand from the Saif Plus logo: deep blue + sky blue on dark navy. */

:root {
  --brand: #1f5fa8;
  --brand-deep: #164a85;
  --brand-sky: #4fa8e8;
  --navy-900: #0b1f35;
  --navy-800: #10294a;
  --navy-700: #16345c;
  --bg: #f2f6fb;
  --surface: #ffffff;
  --surface-2: #f7fafd;
  --line: #dde7f1;
  --text: #14263c;
  --text-2: #51677f;
  --text-3: #7f93a8;
  --ok: #178a50;
  --ok-bg: #e2f5ea;
  --warn: #a8650b;
  --warn-bg: #fdf0da;
  --danger: #c0392b;
  --danger-bg: #fdeae7;
  --info: #1f5fa8;
  --info-bg: #e4eefb;
  --violet: #6d4fc4;
  --violet-bg: #eee9fb;
  --teal: #0e7c86;
  --teal-bg: #dff4f6;
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(16, 42, 74, .06), 0 2px 8px rgba(16, 42, 74, .06);
  --shadow-2: 0 4px 10px rgba(16, 42, 74, .08), 0 12px 32px rgba(16, 42, 74, .12);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic", "Segoe UI Arabic", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.boot { padding: 40px; color: var(--text-3); text-align: center; }

/* ---------- layout shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex-shrink: 0;
  background: linear-gradient(178deg, var(--navy-800) 0%, var(--navy-900) 100%);
  color: #cfe0f2;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .logo svg { flex-shrink: 0; }
/* the SP mark cropped out of the square logo: the circle sits at 49.5% / 34% of the image and spans 53% of its width */
.brand-mark { flex-shrink: 0; display: inline-block; width: var(--s, 40px); height: var(--s, 40px); border-radius: 50%; background: #fff url(brand/saif-plus-logo.jpg) no-repeat;
  background-size: calc(var(--s, 40px) * 1.7); background-position: calc(var(--s, 40px) * -0.345) calc(var(--s, 40px) * -0.08); box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.brand-full { display: block; border-radius: 12px; background: #fff; object-fit: contain; }
/* customer type-ahead (returns-feedback) */
.ta-wrap { position: relative; }
.ta-list { position: absolute; inset-inline: 0; top: calc(100% - 18px); z-index: 60; background: var(--card, #fff); border: 1px solid var(--line, #d7dee8); border-radius: 8px; box-shadow: 0 10px 28px rgba(10, 30, 60, .16); max-height: 260px; overflow-y: auto; }
.ta-item { padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--line, #eef2f7); }
.ta-item:last-child { border-bottom: 0; }
.ta-item.active, .ta-item:hover { background: var(--accent-soft, #eaf2fb); }
.ta-empty { padding: 8px 10px; color: var(--muted, #6b7a90); font-size: 12px; }
.sidebar .logo .name { font-weight: 700; font-size: 15px; color: #fff; letter-spacing: -.01em; line-height: 1.2; }
.sidebar .logo .sub { font-size: 11px; color: #8fb2d8; }

.nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.nav .section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6d8db1; padding: 12px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: #c4d8ee; font-weight: 500; text-decoration: none;
  transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(79, 168, 232, .12); color: #fff; text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(79,168,232,.28), rgba(79,168,232,.10)); color: #fff; box-shadow: inset 2px 0 0 var(--brand-sky); }
[dir="rtl"] .nav a.active { box-shadow: inset -2px 0 0 var(--brand-sky); }
.nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.nav .badge-n {
  margin-inline-start: auto; background: var(--brand-sky); color: #06233f;
  border-radius: 99px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px;
}

.sidebar .foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.sidebar .foot .who { color: #fff; font-weight: 600; }
.sidebar .foot .role { color: #8fb2d8; font-size: 11px; text-transform: capitalize; }
.sidebar .foot .links { margin-top: 8px; display: flex; gap: 12px; }
.sidebar .foot a { color: #9fc3e8; font-size: 12px; cursor: pointer; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.topbar .spacer { flex: 1; }

.content { padding: 22px 26px 60px; max-width: 1180px; width: 100%; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 9px;
  padding: 8px 14px; font-weight: 600; font-size: 13.5px;
  cursor: pointer; background: var(--surface); color: var(--text);
  border-color: var(--line);
  transition: transform .08s, box-shadow .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { box-shadow: var(--shadow-1); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand-sky); outline-offset: 2px; }
.btn.primary { background: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%); color: #fff; border-color: var(--brand-deep); box-shadow: 0 2px 6px rgba(31,95,168,.35); }
.btn.primary:hover { background: linear-gradient(180deg, #2769b5 0%, var(--brand) 100%); }
.btn.danger { background: var(--danger); color: #fff; border-color: #a93226; }
.btn.ok { background: var(--ok); color: #fff; border-color: #116b3d; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--info-bg); box-shadow: none; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 15px; height: 15px; }

/* ---------- cards / stats ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
  padding: 18px 20px; margin-bottom: 18px;
}
.card h2 { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h2 svg { width: 18px; height: 18px; flex-shrink: 0; }
.card h2 .hint { font-weight: 400; font-size: 12px; color: var(--text-3); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-1); position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px; background: var(--accent, var(--brand)); }
.stat .label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin-top: 2px; }
.stat .value small { font-size: 13px; color: var(--text-3); font-weight: 500; }
.stat.clickable { cursor: pointer; transition: box-shadow .15s; }
.stat.clickable:hover { box-shadow: var(--shadow-2); }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); }
/* Compact by request (2026-10-16): tighter padding, smaller type, headers may wrap, and
   long free text (company names, file names) wraps inside a bounded cell instead of
   stretching its column across the screen. Codes and dates never break mid-value. */
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: start; padding: 6px 8px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .02em;
  color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: normal; line-height: 1.2; vertical-align: bottom;
}
table.data td { padding: 5px 8px; border-bottom: 1px solid #ecf2f8; vertical-align: middle; line-height: 1.3; max-width: 220px; overflow-wrap: break-word; }
table.data tr:last-child td { border-bottom: none; }
table.data tr.rowlink { cursor: pointer; transition: background .12s; }
table.data tr.rowlink:hover { background: #f2f8fe; }
table.data .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; white-space: nowrap; }
table.data .badge { font-size: 10.5px; padding: 2px 7px; }
table.data input[type="checkbox"] { vertical-align: middle; }
table.data td.nowrap { white-space: nowrap; }
.empty { padding: 34px; text-align: center; color: var(--text-3); }

/* ---------- badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 99px; padding: 2px 10px; font-size: 11.5px; font-weight: 700;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.badge.gray { background: #eef1f5; color: #5a6b7d; }
.badge.blue { background: var(--info-bg); color: var(--info); }
.badge.sky { background: #e3f2fd; color: #1272b6; }
.badge.green { background: var(--ok-bg); color: var(--ok); }
.badge.amber { background: var(--warn-bg); color: var(--warn); }
.badge.red { background: var(--danger-bg); color: var(--danger); }
.badge.violet { background: var(--violet-bg); color: var(--violet); }
.badge.teal { background: var(--teal-bg); color: var(--teal); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- forms ---------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.field label .req { color: var(--danger); }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; background: #fff; font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand-sky); box-shadow: 0 0 0 3px rgba(79,168,232,.18);
}
.field textarea { resize: vertical; min-height: 64px; }
.field .help { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

.lines-editor { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lines-editor table { width: 100%; border-collapse: collapse; }
.lines-editor th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); background: var(--surface-2); padding: 7px 8px; text-align: start; }
.lines-editor td { padding: 5px 5px; border-top: 1px solid #eef3f8; vertical-align: top; }
.lines-editor input, .lines-editor select { width: 100%; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 6px 7px; font-size: 13px; }
/* the shipping lines on a phone (2026-11-25, [B]'s worker adds lines by hand): each line a card, every box named, big enough to type */
@media (max-width: 560px) {
  .ship-lines { border: 0; overflow: visible; }
  .ship-lines table, .ship-lines tbody { display: block; width: 100%; }
  .ship-lines thead { display: none; }
  .ship-lines tr { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
  .ship-lines td { display: block; padding: 0; border: 0; grid-column: span 3; }
  .ship-lines td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 3px; }
  .ship-lines td.ship-place { grid-column: span 2; }   /* the place number beside its city (2026-11-30) */
  .ship-lines td.ship-dest { grid-column: span 4; }
  .ship-lines td.ship-note, .ship-lines td.rm-cell { grid-column: 1 / -1; }
  .ship-lines td.rm-cell { text-align: end; }
  .ship-lines input, .ship-lines select { border: 1px solid var(--line); background: var(--surface); font-size: 16px; padding: 10px; }   /* 16px: the phone does not zoom in */
}
.ship-place input { text-align: center; font-weight: 600; }
.ship-places { margin-top: 8px; font-size: 14px; }
/* «إضافة سطر» on a trip page: two columns of big boxes, one on a phone */
.ship-add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.ship-add-grid .field.full { grid-column: 1 / -1; }
.ship-add-grid input, .ship-add-grid select { font-size: 16px; }
@media (max-width: 560px) { .ship-add-grid { grid-template-columns: 1fr; } }
.lines-editor input:hover, .lines-editor select:hover { border-color: var(--line); }
.lines-editor input:focus, .lines-editor select:focus { outline: none; border-color: var(--brand-sky); background: #fff; box-shadow: 0 0 0 2px rgba(79,168,232,.15); }
/* an example in an empty box reads as an example, never as a value someone typed ([B] 2026-11-19: the supervisor took 06918 for his own) */
input::placeholder, textarea::placeholder { color: #b3bcc8; opacity: 1; font-style: italic; }
.lines-editor .rm { color: var(--danger); background: none; border: none; cursor: pointer; padding: 6px; border-radius: 6px; }
.lines-editor .rm:hover { background: var(--danger-bg); }

.form-actions { display: flex; gap: 10px; margin-top: 16px; align-items: center; flex-wrap: wrap; }

/* ---------- filter bar ---------- */

.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.filters .field { min-width: 140px; }
.filters .field input, .filters .field select { padding: 7px 9px; }
.filters .grow { flex: 1; min-width: 180px; }

/* ---------- detail page ---------- */

.detail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-head .ref { font-size: 21px; font-weight: 700; letter-spacing: -.02em; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.detail-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 18px; }
.kv .item .k { font-size: 11.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kv .item .v { font-size: 14px; font-weight: 500; margin-top: 1px; word-break: break-word; }
.kv .item .v.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }

.apr-box { min-width: 0; flex: 1; }
.apr-box .badge { white-space: normal; height: auto; line-height: 1.5; margin-block: 2px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 980px) { .two-col { grid-template-columns: minmax(0, 1fr); } }

/* timeline */
.timeline { position: relative; padding-inline-start: 18px; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; inset-inline-start: -17px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-sky); box-shadow: 0 0 0 3px #dcecfa; }
.tl-item .tl-when { font-size: 11px; color: var(--text-3); }
.tl-item .tl-text { font-size: 13px; margin-top: 1px; }
.tl-item .tl-who { font-weight: 600; }

/* attachments */
.attach-list { display: flex; flex-wrap: wrap; gap: 10px; }
.attach {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
  background: var(--surface-2); max-width: 100%;
}
.attach img.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 7px; }
.attach .icon { width: 40px; height: 40px; border-radius: 7px; background: var(--info-bg); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.attach .meta { min-width: 0; }
.attach .fname { font-size: 12.5px; font-weight: 600; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach .fsub { font-size: 11px; color: var(--text-3); }
.attach .acts { display: flex; gap: 2px; }
.attach .acts button, .attach .acts a { background: none; border: none; cursor: pointer; color: var(--brand); padding: 4px; border-radius: 6px; display: flex; }
.attach .acts button:hover, .attach .acts a:hover { background: var(--info-bg); }

/* comments */
.comment { border-inline-start: 3px solid var(--brand-sky); background: var(--surface-2); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; }
.comment .c-head { font-size: 11.5px; color: var(--text-3); }
.comment .c-head b { color: var(--text-2); }
.comment .c-text { font-size: 13.5px; margin-top: 2px; white-space: pre-wrap; }

/* ---------- login ---------- */

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(79,168,232,.35), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(31,95,168,.45), transparent 55%),
    linear-gradient(160deg, var(--navy-800), var(--navy-900));
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: rgba(255,255,255,.98); border-radius: 18px;
  box-shadow: 0 20px 60px rgba(4, 16, 32, .5);
  padding: 30px 28px;
}
.login-card .brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; text-align: center; }
.login-card .brand .t { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.login-card .brand .s { font-size: 12.5px; color: var(--text-2); }
.login-card .field { margin-bottom: 12px; }
.login-card .btn { width: 100%; padding: 10px; font-size: 14.5px; margin-top: 6px; }
.login-card .lang-row { text-align: center; margin-top: 16px; }
.login-err { background: var(--danger-bg); color: var(--danger); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; font-weight: 600; }

/* ---------- modal ---------- */

.modal-back {
  position: fixed; inset: 0; background: rgba(9, 24, 43, .55);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 18px;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-2);
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  padding: 20px 22px;
}
.modal.wide { max-width: 760px; }
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 14px; letter-spacing: -.01em; }
/* the buttons stay in sight however long the dialog is (2026-11-19: a list of 240 codes pushed "Close" out of view) */
.modal .m-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; position: sticky; bottom: -20px; background: #fff; padding: 12px 0 20px; margin-bottom: -20px; z-index: 1; }
.modal .field { margin-bottom: 11px; }

/* ---------- server-unreachable overlay ---------- */

#server-down {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(9, 24, 43, .72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#server-down .sd-card {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-2);
  padding: 26px 28px; max-width: 440px; text-align: center;
}
#server-down .sd-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
#server-down .sd-text { font-size: 13.5px; color: var(--text-2); margin-bottom: 12px; line-height: 1.6; }
#server-down .sd-code {
  display: block; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; font-family: ui-monospace, Menlo, monospace;
  font-size: 12.5px; margin-bottom: 16px; direction: ltr;
}

/* ---------- toasts ---------- */

#toasts { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--navy-800); color: #fff; border-radius: 10px; padding: 11px 16px;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-2);
  max-width: 360px; animation: toast-in .25s ease;
  border-inline-start: 4px solid var(--brand-sky);
}
.toast.err { border-inline-start-color: #ff7b6b; }
.toast.ok { border-inline-start-color: #4ade80; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- misc ---------- */

.notice { border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 500; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.info { background: var(--info-bg); color: var(--info); }
.notice.danger { background: var(--danger-bg); color: var(--danger); }

.pill-tabs { display: inline-flex; background: #e8eef5; border-radius: 10px; padding: 3px; gap: 2px; }
.pill-tabs button {
  border: none; background: transparent; padding: 6px 14px; border-radius: 8px;
  font-weight: 600; font-size: 13px; cursor: pointer; color: var(--text-2);
  transition: background .15s, color .15s;
}
.pill-tabs button.active { background: #fff; color: var(--brand); box-shadow: var(--shadow-1); }
.pill-tabs .tab-n { display: inline-block; min-width: 20px; padding: 0 5px; margin-inline-start: 3px; border-radius: 10px; background: #d4deea; color: #27496d; font-size: 11.5px; font-weight: 700; line-height: 18px; text-align: center; }
.pill-tabs .tab-n:empty { display: none; }
.detail-head .ref.doc-title { font-family: inherit; letter-spacing: normal; }
.doc-name { min-width: 130px; }

.report-section h3 { font-size: 14.5px; font-weight: 700; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.report-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.report-head .rh-title { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.report-head .rh-range { color: var(--text-2); font-size: 13px; }

.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mt { margin-top: 14px; }
.mb0 { margin-bottom: 0; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { margin-inline-start: auto; }

/* mobile */
/* ---------- v1.8: home screen (module tiles) ---------- */
.home-hello { margin: 2px 2px 16px; }
.home-hello h2 { margin: 0 0 2px; font-size: 22px; letter-spacing: -.01em; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 18px; }
.mod-tile {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 40, 80, .06); position: relative; overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.mod-tile::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--accent); }
.mod-tile:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 22px rgba(15, 40, 80, .12); }
.mod-tile .mt-top { display: flex; align-items: center; gap: 12px; }
.mod-tile .mt-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent);
}
.mod-tile .mt-icon svg { width: 24px; height: 24px; }
.mod-tile .mt-title { font-weight: 700; font-size: 16px; line-height: 1.25; }
.mod-tile .mt-level { font-size: 11.5px; color: var(--accent); font-weight: 600; margin-top: 2px; }
.mod-tile .mt-desc { font-size: 12.5px; color: var(--text-2, #5b6b80); line-height: 1.5; }
.mod-tile .mt-facts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.mod-tile .mt-fact { flex: 1 1 0; min-width: 76px; padding: 7px 9px; border-radius: 10px; background: var(--bg); display: flex; flex-direction: column; }
.mod-tile .mt-fact b { font-size: 18px; line-height: 1.1; }
.mod-tile .mt-fact span { font-size: 11px; color: var(--text-2, #5b6b80); }
.mod-tile .mt-fact.warn b { color: var(--warn); }
.mod-tile .mt-fact.danger b { color: var(--danger); }

/* ---------- v1.8: sidebar inside a module ---------- */
.nav .section.mod-head { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 700; padding: 16px 10px 2px; }
.nav .section.mod-head svg { width: 18px; height: 18px; color: var(--accent); }
.nav .mod-level { font-size: 11px; color: #8fb2d8; padding: 0 10px 8px; }

/* ---------- v1.9: operations manual ---------- */
.manual-link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin: 0 0 18px; border-radius: 12px; background: var(--surface); border: 1px dashed var(--line); color: var(--text); }
.manual-link svg { width: 22px; height: 22px; color: var(--brand); flex-shrink: 0; }
.manual-link:hover { text-decoration: none; border-color: var(--brand); }
.man-top { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px; }
.man-toc { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.man-toc .chip { cursor: pointer; }
.man-section { border-inline-start: 4px solid var(--accent); page-break-inside: avoid; }
.man-section h3 { font-size: 14px; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.man-head { display: flex; align-items: center; gap: 12px; }
.man-head .mt-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); flex-shrink: 0; }
.man-head .mt-icon svg { width: 22px; height: 22px; }
.man-head h2 { margin: 0; }
.man-summary { font-size: 13.5px; line-height: 1.7; margin: 10px 0 0; }
.man-steps td { vertical-align: top; font-size: 12.5px; line-height: 1.6; }
.man-steps td:nth-child(3) { min-width: 220px; }
.man-steps td:nth-child(5) { min-width: 220px; }
.man-steps tr.w-gap td { background: var(--danger-bg); }
.uat-list { padding-inline-start: 18px; margin: 0; }
.uat-item { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg); }
.uat-item.done { opacity: .7; }
.uat-item.done .uat-text { text-decoration: line-through; }
.uat-item label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; font-size: 13px; line-height: 1.6; }
.uat-item input { margin-top: 5px; }
.uat-expect { font-size: 12.5px; color: var(--text-2, #5b6b80); margin: 4px 0 0 26px; line-height: 1.6; }
[dir="rtl"] .uat-expect { margin: 4px 26px 0 0; }
.gap-list { padding-inline-start: 18px; margin: 0; }
.gap-item { margin: 0 0 6px; font-size: 13px; line-height: 1.6; }
@media print { .man-section { box-shadow: none; border: 1px solid #ccc; } .uat-item input { display: inline-block; } }

/* ---------- v2.1: container tracker + document intake ---------- */
.tracker-card { padding: 14px 16px 10px; }
.tracker { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 4px 2px 2px; }
.trk-step { display: flex; flex-direction: column; align-items: center; min-width: 92px; flex: 0 0 auto; text-align: center; }
.trk-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 700; color: #fff; background: #c9d2dd; box-shadow: 0 0 0 4px var(--surface); }
.trk-step.done .trk-dot { background: var(--danger); }
.trk-step.current .trk-dot { box-shadow: 0 0 0 4px var(--surface), 0 0 0 8px var(--danger-bg); }
.trk-step.current.done .trk-dot:empty::after { content: '✓'; }
.trk-label { font-size: 12px; margin-top: 6px; color: var(--text-2, #5b6b80); }
.trk-step.done .trk-label { color: var(--text); font-weight: 600; }
.trk-step.current .trk-label { font-weight: 700; }
.trk-date { font-size: 11px; color: var(--text-2, #5b6b80); margin-top: 2px; min-height: 14px; }
.trk-line { flex: 1 1 24px; min-width: 18px; height: 4px; background: #e3e8ee; margin-top: 13px; border-radius: 2px; }
.trk-line.done { background: var(--danger); }
.doc-banner { border-inline-start: 4px solid var(--brand); }
.doc-banner .flex { flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 860px) { .trk-step { min-width: 78px; } .trk-label { font-size: 11px; } }
@media print { .tracker { overflow: visible; } }

/* ---------- v2.1: three languages ---------- */
.lang-switch { display: inline-flex; gap: 6px; align-items: center; }
.lang-switch a { cursor: pointer; color: #9fc3e8; }
.lang-switch a.active { color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.lang-switch .sep { color: #6d8db1; }
.login-card .lang-switch a { color: var(--brand); }
.login-card .lang-switch a.active { color: var(--brand-deep, #164a85); }
.login-card .lang-switch .sep { color: var(--line); }
/* Urdu letters sit lower and carry more marks than Arabic: a little more line height keeps them legible */
[lang="ur"] body, [lang="ur"] .content, [lang="ur"] .sidebar { line-height: 1.75; }
[lang="ur"] { --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Arabic", "Noto Naskh Arabic", "Segoe UI Arabic", Arial, sans-serif; }

/* ---------- v2.0: sheet actions, QC ---------- */
.sheet-acts { border-inline-start: 4px solid var(--brand-sky); }
.sheet-acts .flex { flex-wrap: wrap; gap: 6px; }
.qc-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; margin: 6px 0; background: var(--bg); font-size: 13px; line-height: 1.6; }
.qc-item.critical { background: var(--danger-bg); }
.qc-item.warn { background: var(--warn-bg); }
.qc-item .badge { flex-shrink: 0; margin-top: 2px; }

/* ---------- v1.8: users screen (department + access matrix) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; gap: 5px; align-items: center; font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 11%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); white-space: nowrap; }
.chip b { font-weight: 600; }
.inactive-row { opacity: .55; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.check-row { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; margin: 4px 0 12px; border-radius: 10px; background: var(--violet-bg); font-size: 13px; cursor: pointer; }
.check-row input { margin-top: 3px; }
.tpl-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.matrix-title { font-weight: 700; font-size: 13px; margin: 4px 0 6px; }
.matrix { width: 100%; border-collapse: collapse; }
.matrix td { padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
.matrix td:first-child { border-inline-start: 3px solid var(--accent); padding-inline-start: 10px; }
.matrix td:last-child { width: 44%; }
.matrix select { width: 100%; }
.mx-mod { display: flex; align-items: center; gap: 7px; }
.mx-mod svg { width: 16px; height: 16px; color: var(--accent); }
#f-access.disabled { opacity: .4; pointer-events: none; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .nav { display: flex; flex-wrap: wrap; padding: 6px; }
  .nav .section { display: none; }
  .nav .section.mod-head { display: flex; width: 100%; padding: 6px 10px 2px; }
  .nav .mod-level { display: none; }
  .mod-grid { grid-template-columns: 1fr; }
  .nav a { padding: 7px 10px; }
  .sidebar .foot { display: flex; align-items: center; gap: 12px; }
  .sidebar .foot .links { margin-top: 0; margin-inline-start: auto; }
  .content { padding: 14px 14px 40px; }
  .topbar { padding: 10px 14px; }
}

/* print — reports and detail pages come out clean */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .filters, .form-actions, .btn, #toasts, .no-print { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card, .table-wrap { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  .print-only { display: block !important; }
}
.print-only { display: none; }

/* v2.2: the Users matrix groups the cross-module grants (all reports, weekly QC) under a heading */
.matrix tr.mx-group td { padding: 14px 8px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); border-bottom: none; }

/* v2.3: frozen screen while an action runs (dialogs at z-index 100 stay above it) */
#busy { position: fixed; inset: 0; z-index: 95; background: rgba(9, 24, 43, .45); display: flex; align-items: center; justify-content: center; cursor: progress; }   /* no backdrop-filter: iOS Safari may skip repainting the page after a blurred fixed layer is removed */
.busy-box { background: var(--surface); border-radius: var(--radius); padding: 16px 22px; box-shadow: var(--shadow-2); display: flex; align-items: center; gap: 12px; font-weight: 600; }
.busy-spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: busyspin .8s linear infinite; flex-shrink: 0; }
@keyframes busyspin { to { transform: rotate(360deg); } }
/* v2.3: the container page's single next step */
.next-card .next-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn.lg { font-size: 15px; padding: 12px 20px; }

/* ---------- v2.7: carton labels. Sizes in mm: the printed label is the page (roll) or a cell of an A4 grid ---------- */
.lbl-sheet { --w: 100; --h: 50; --m: 3; --f: 1; --u: min(var(--h), calc(var(--w) * 0.55)); }
.lbl { position: relative; box-sizing: border-box; width: calc(var(--w) * 1mm); height: calc(var(--h) * 1mm); padding: calc(var(--m) * 1mm); background: #fff; color: #000; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; line-height: 1.15; }
.lbl-top { display: flex; align-items: flex-start; justify-content: space-between; gap: calc(var(--u) * 0.04mm); }
.lbl-no { font-size: calc(var(--u) * 0.27mm * var(--f)); font-weight: 800; letter-spacing: .02em; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; line-height: 1; }
.lbl-ctn { border: calc(var(--u) * 0.012mm) solid #000; border-radius: calc(var(--u) * 0.04mm); padding: calc(var(--u) * 0.02mm) calc(var(--u) * 0.06mm); text-align: center; line-height: 1; flex-shrink: 0; }
.lbl-ctn span { display: block; font-size: calc(var(--u) * 0.075mm * var(--f)); margin-bottom: calc(var(--u) * 0.02mm); }
.lbl-ctn b { font-size: calc(var(--u) * 0.17mm * var(--f)); font-weight: 800; }
/* the value word (2026-11-21): نعم or لا in a box between the invoice number and the carton box */
.lbl-val { align-self: center; border: calc(var(--u) * 0.012mm) solid #000; border-radius: calc(var(--u) * 0.04mm); padding: calc(var(--u) * 0.03mm) calc(var(--u) * 0.045mm); font-size: calc(var(--u) * 0.13mm * var(--f)); font-weight: 800; line-height: 1; flex-shrink: 0; white-space: nowrap; }
.lbl-mark-word { font-size: 1.15em; }
.lbl-cust { font-size: calc(var(--u) * 0.105mm * var(--f)); font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lbl-row { display: flex; justify-content: space-between; align-items: baseline; gap: calc(var(--u) * 0.06mm); }
.lbl-city { font-size: calc(var(--u) * 0.115mm * var(--f)); font-weight: 700; }
.lbl-phone { font-size: calc(var(--u) * 0.095mm * var(--f)); font-family: ui-monospace, Menlo, Consolas, monospace; }
.lbl-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: calc(var(--u) * 0.06mm); }
.lbl-bar { flex: 1 1 auto; height: calc(var(--u) * 0.2mm); max-width: 62%; }
.lbl-bar svg { width: 100%; height: 100%; display: block; }
.lbl-foot { font-size: calc(var(--u) * 0.055mm * var(--f)); color: #333; white-space: nowrap; }
.lbl-preview { overflow: auto; padding: 8px; background: #eef1f5; border-radius: 10px; }
.lbl-preview .lbl-sheet { display: inline-block; }
.lbl-preview { text-align: center; }
.lbl-preview .lbl { border: 1px dashed #9aa5b1; box-shadow: var(--shadow-1); text-align: start; }
#lbl-print { display: none; }
@media print {
  body.lbl-printing { margin: 0; padding: 0; background: #fff; }
  body.lbl-printing > :not(#lbl-print) { display: none !important; }
  #lbl-print { display: block !important; }
  .lbl-sheet.roll .lbl + .lbl { break-before: page; page-break-before: always; }
  .lbl-sheet.a4 { display: flex; flex-wrap: wrap; gap: 2mm; align-content: flex-start; }
  .lbl-sheet.a4 .lbl { border: 0.2mm dashed #888; break-inside: avoid; page-break-inside: avoid; }
}

/* ---------- the picker's In Progress page (2026-11-17): one big box for a phone or a hand scanner ---------- */
.pk-scan { display: flex; gap: 8px; align-items: stretch; }
.pk-input { flex: 1; min-width: 0; font-size: 1.35rem; padding: 14px 12px; letter-spacing: .02em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pk-cam { padding: 0 14px; }
.pk-cam svg { width: 24px; height: 24px; }
.pk-video { margin-top: 10px; }
.pk-video video { width: 100%; max-height: 280px; border-radius: 10px; background: #000; display: block; margin-bottom: 6px; object-fit: cover; }
.pk-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.pk-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pk-name { font-size: 1.15rem; font-weight: 700; }
.pk-sub { margin-top: 4px; color: var(--text-2); }
.pk-status { margin-top: 6px; }
.pk-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pk-btn { flex: 1; min-height: 48px; font-size: 1.05rem; justify-content: center; }
.pk-btn svg { width: 20px; height: 20px; }
@media (max-width: 560px) {
  .pk-scan { flex-wrap: wrap; }
  .pk-input { flex-basis: 100%; font-size: 1.2rem; }
  .pk-scan .btn { flex: 1; min-height: 48px; justify-content: center; }
}

/* ---------- requests to Hameed's warehouses (2026-11-23): a phone first; the product photo is Odoo's 256 px one ---------- */
.rp-row { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; color: inherit; text-decoration: none; }
.rp-row:hover { border-color: var(--brand-sky); }
.rp-row.mine { border-inline-start: 4px solid var(--teal); }
.rp-thumb { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; background: var(--surface-2); flex: none; }
.rp-row-body { flex: 1; min-width: 0; }
.rp-row-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.rp-row-prod { margin-top: 3px; overflow-wrap: anywhere; }
.rp-row-sub { margin-top: 3px; font-size: 12.5px; color: var(--text-2); }
/* the quantity Hameed reads from across the room ([B] 2026-11-25): cartons big, units under, the total small */
.rp-big { flex: none; min-width: 78px; align-self: center; text-align: center; border-radius: 12px; padding: 6px 10px; background: #eaf3fd; color: var(--navy-800); }
.rp-big .n { font-size: 26px; font-weight: 800; line-height: 1.1; }
.rp-big .u { font-size: 12.5px; font-weight: 700; }
.rp-big .s { font-size: 11px; color: var(--text-2); margin-top: 1px; }
.rp-big.zero { opacity: .55; }
.rp-ask-box { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.rp-ask-box .k { font-weight: 700; }
.rp-ask-box .rp-big { min-width: 110px; }
.rp-ask-box .rp-big .n { font-size: 34px; }
.rp-stock-row { width: 100%; text-align: start; background: var(--surface); font: inherit; cursor: pointer; }
.rp-prod { display: flex; gap: 12px; align-items: center; }
.rp-photo { width: 96px; height: 96px; object-fit: contain; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.rp-code { font-size: 1.15rem; font-weight: 700; }
.rp-name { margin: 2px 0 4px; overflow-wrap: anywhere; }
.rp-qty { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.rp-qty input { font-size: 1.2rem; padding: 10px; }
.rp-now { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 8px; }
.rp-fig { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--surface-2); }
.rp-fig .k { font-size: 12px; color: var(--text-2); font-weight: 600; }
.rp-fig .v { font-size: 1.15rem; font-weight: 700; margin-top: 2px; }
.rp-modes { display: flex; gap: 14px; flex-wrap: wrap; margin: 4px 0 10px; }
.rp-modes label { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; min-height: 36px; }
.rp-cand { display: block; width: 100%; text-align: start; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 8px; background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.rp-cand:hover { border-color: var(--brand-sky); }
.rp-places { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 6px; }
.rp-place { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; min-height: 36px; }
@media (max-width: 560px) {
  .rp-photo { width: 76px; height: 76px; }
}

/* ---------- shipments to Hameed's askers (2026-11-28): the board by product, the paper and its barcode ---------- */
.rp-board-row { cursor: pointer; align-items: center; }
.rp-board-row input.rp-pick { margin: 0 4px; }
.rp-sh-bar svg { height: 52px; width: auto; max-width: 260px; display: block; }
.rp-sh-got { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.rp-ship-line h4 { margin: 10px 0 4px; }
@media print {
  .rp-sh-paper { border: 1px solid #999; }
  .rp-sh-paper .rp-thumb { display: none; }
  .rp-sh-bar svg { height: 60px; max-width: none; }
}

/* ---------- "the app is updating" (2026-11-28): a bar over everything while a deploy runs, then "updated, reload" ---------- */
.upd-bar { position: fixed; inset-inline: 0; top: 0; z-index: 9999; display: flex; gap: 10px; align-items: center; justify-content: center;
  padding: 10px 14px; font-weight: 600; box-shadow: 0 2px 10px rgba(0,0,0,.15); flex-wrap: wrap; text-align: center; }
.upd-bar.now { background: #fef3c7; color: #78350f; border-bottom: 2px solid #f59e0b; }
.upd-bar.done { background: #dcfce7; color: #14532d; border-bottom: 2px solid #22c55e; }
@media print { .upd-bar { display: none !important; } }

/* a figure that needs the eye (2026-11-28: the transfer shortage alarm) */
.danger-text { color: var(--danger); font-weight: 600; }
