:root {
  font-family: "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  color: #162f38;
  background: #f3f7f7;
  color-scheme: light;
  --muted: #526c73;
  --line: #dce7e7;
  --teal: #07695f;
  --teal-dark: #05554e;
  --radius: 18px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 285px; font-size: 15px; line-height: 1.65; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.65rem); line-height: 1.38; letter-spacing: -.035em; }
h2 { font-size: 1.26rem; line-height: 1.55; }
h3 { font-size: 1rem; overflow-wrap: anywhere; }
bdi { overflow-wrap: anywhere; }
button, input, textarea { font: inherit; }
input, textarea { color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid #168f84; outline-offset: 3px; }
.sr-only { position: absolute; overflow: hidden; clip-path: inset(50%); width: 1px; height: 1px; white-space: nowrap; }
.shell { width: min(100% - 48px, 1240px); margin-inline: auto; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.12rem; line-height: 1.45; }
.brand small { font: 700 .61rem/1.4 Arial, sans-serif; letter-spacing: .13em; color: var(--muted); }
.brand-mark { width: 43px; height: 43px; border-radius: 13px; display: grid; place-items: center; background: var(--teal); }
.brand-mark span { width: 23px; height: 11px; display: block; border: 2px solid white; border-radius: 12px; transform: rotate(-45deg); background: linear-gradient(to right, white 50%, transparent 50%); }
.intro { position: relative; isolation: isolate; overflow: hidden; padding: 31px 35px 34px; margin-block: 29px 23px; border-radius: 22px; color: #fff; background: linear-gradient(115deg, #076659, #10363c 67%, #132e38); }
.intro p { color: #d8eeec; margin-top: 7px; }
.intro::before, .intro::after { content: ""; position: absolute; z-index: -1; inset-inline-end: 6%; top: -134px; width: 240px; height: 240px; border: 1px solid #9ce9db44; border-radius: 42px; transform: rotate(-38deg); }
.intro::after { inset-inline-end: 11%; top: 13px; border-radius: 50%; }
.workspace-grid { display: grid; grid-template-columns: minmax(245px, 28%) minmax(0, 1fr); gap: 22px; align-items: start; padding-bottom: 44px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 14px #16333606; }
.session { position: sticky; top: 16px; padding: 19px; }
.session-head, .panel-head, .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.session-head .muted { font-size: .77rem; }
.count { display: inline-grid; place-items: center; min-width: 29px; padding: 0 7px; height: 29px; border-radius: 9px; color: #07594f; background: #e0f1ed; font: 700 .85rem Arial, sans-serif; }
.session #session-list { margin-block: 14px; display: grid; gap: 9px; max-height: 46vh; overflow: auto; }
.session-empty { padding: 19px 13px; text-align: center; border: 1px dashed #c4d9d9; border-radius: 13px; background: #f7fafa; }
.session-empty p { margin-top: 4px; font-size: .84rem; }
.session-item { padding: 10px 11px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.session-item.active { background: #edf7f5; border-color: #a6d0c9; }
.session-item .meta { margin-top: 4px; }
.session-actions { display: flex; flex-wrap: wrap; gap: 4px 11px; margin-top: 5px; }
.session-actions button { padding: 1px 0; border: 0; background: transparent; color: var(--teal-dark); font-size: .81rem; font-weight: 700; }
.session-actions button:last-child { color: #a33d3b; }
.steps { display: flex; align-items: stretch; gap: 4px; margin-bottom: 15px; background: #e6efef; border: 1px solid #d5e5e4; border-radius: 14px; padding: 4px; }
.steps button { flex: 1; padding: 8px 7px; min-height: 42px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #3e5c63; font-weight: 700; font-size: .88rem; line-height: 1.4; }
.steps button[aria-current] { background: #fff; border-color: #d9e9e7; color: var(--teal-dark); box-shadow: 0 1px 4px #183e3812; }
.steps button:hover:not([aria-current]) { background: #f2f8f7; }
.steps .count { height: 19px; min-width: 19px; font-size: .71rem; background: #fff0d4; color: #7c4b09; vertical-align: middle; }
.stage, .stack { display: grid; gap: 14px; }
.panel { padding: 22px; }
.panel > .muted { margin-top: -8px; }
.panel > h2 + .muted { margin-top: 3px; }
.muted, .meta { color: var(--muted); }
.meta { font-size: .81rem; overflow-wrap: anywhere; }
.search-box { display: flex; align-items: center; gap: 10px; margin-block: 17px 9px; padding-inline: 13px 0; border: 1px solid #b6cdcc; border-radius: 11px; background: #f8fbfa; }
.search-box:focus-within { outline: 2px solid #168f84; outline-offset: 1px; }
.search-box span { font: 1.6rem Arial, sans-serif; color: var(--teal); }
.search-box input { border: 0; background: transparent; outline: none; }
input:not([type="checkbox"]), textarea { width: 100%; min-width: 0; padding: 9px 11px; border: 1px solid #bdd0d1; border-radius: 9px; background: #fbfdfd; }
.search-box input:not([type="checkbox"]) { border: 0; background: transparent; outline: none; padding-inline-start: 0; }
#search:placeholder-shown { direction: rtl; text-align: right; }
textarea { resize: vertical; }
input[type="checkbox"] { accent-color: var(--teal); width: 17px; height: 17px; flex: none; }
.results { display: grid; gap: 7px; }
.results:not(:empty) { margin-top: 12px; }
.result { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); padding: 9px 12px; border-radius: 11px; }
.button { display: inline-flex; flex: none; gap: 7px; justify-content: center; align-items: center; min-height: 39px; border-radius: 9px; border: 1px solid transparent; padding: 6px 12px; font-size: .86rem; font-weight: 700; text-align: center; }
.primary { color: #fff; background: var(--teal); border-color: var(--teal); }
.primary:hover:not(:disabled) { background: var(--teal-dark); }
.secondary { color: var(--teal-dark); background: #fff; border-color: #c3d9d7; }
.secondary:hover:not(:disabled) { background: #edf7f5; }
.full { width: 100%; }
.barcode-form, .print-controls { display: flex; gap: 9px; flex-wrap: wrap; align-items: end; margin-top: 13px; }
.barcode-form input { width: auto; flex: 1 1 130px; }
.scan-icon { border: 2px dashed currentColor; border-radius: 4px; width: 14px; height: 12px; }
#barcode-status { margin-top: 10px; }
.tag { flex: none; display: inline-block; font-size: .78rem; font-weight: 700; color: #095b52; background: #e5f5f1; border-radius: 6px; padding: 2px 8px; }
.notice { background: #edf6f6; border: 1px solid #d4e7e6; border-radius: 10px; color: #244852; padding: 9px 12px; }
.warning { background: #fff6e5; border-color: #f1dfb8; color: #70480e; }
.notice p + p, .notice details, .product-meta, #active-empty, #replacement { margin-top: 10px; }
.source-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; direction: ltr; text-align: left; font: .88rem/1.6 Arial, sans-serif; }
details summary { cursor: pointer; font-weight: 700; }
.evidence { border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.evidence > p { margin-block: 6px; }
.evidence .english { direction: ltr; text-align: left; overflow-wrap: anywhere; font: .94rem/1.55 Arial, sans-serif; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 13px; }
.field-grid .field-grid { margin-top: 0; }
.wide { grid-column: 1 / -1; }
.field-grid label, .print-controls label { font-size: .86rem; font-weight: 700; }
.field-grid label :is(input, textarea):not([type="checkbox"]), .print-controls input { display: block; margin-top: 3px; font-weight: 400; }
.check { display: flex; align-items: center; gap: 6px; }
.product-meta { padding-block: 4px 8px; }
.print-controls label { width: 96px; }
#print-status { margin-top: 9px; }
.label-card { border: 1px solid var(--line); border-radius: 13px; padding: 14px; }
.label-card .row, .dialog-actions { flex-wrap: wrap; }
.label-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: 12px; margin-block: 10px; }
.label-editor .meta { display: block; margin-bottom: 4px; }
.preview { min-height: 180px; display: grid; align-content: center; justify-items: center; background: #e9f0ef; border-radius: 9px; padding: 8px; overflow: auto; }
.preview .paper { max-width: 100%; border: 1px solid #ebeeee; }
.paper { width: var(--paper-width, 75mm); height: var(--paper-height, 60mm); padding: 2mm; white-space: pre-wrap; overflow-wrap: anywhere; overflow: hidden; background: #fff; color: #000; direction: rtl; text-align: right; font: 9pt/1.35 "Noto Sans Arabic", Tahoma, Arial, sans-serif; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); color: inherit; background: #fff; padding: 0; width: min(calc(100% - 30px), 520px); }
dialog::backdrop { background: #092d37b3; }
dialog video { width: 100%; display: block; background: #142f37; min-height: 160px; max-height: 47vh; margin-block: 12px; border-radius: 11px; }
#scanner-status, #print-confirm-summary, .dialog-actions { margin-top: 12px; }
#print-job { display: none; }
#print-job.measuring { display: block; position: fixed; visibility: hidden; inset: 0 auto auto 0; }
@media (max-width: 740px) {
  .shell { width: min(100% - 24px, 1240px); }
  .intro { padding: 21px; margin-block-start: 14px; }
  .workspace-grid { grid-template-columns: 1fr; gap: 12px; }
  .session { position: static; padding: 13px; }
  .session #session-list { max-height: 145px; margin-block: 8px; }
  .session-empty { padding: 8px; }
  .panel { padding: 15px; }
}
@media (max-width: 440px) {
  .steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps button { min-height: 36px; }
  .field-grid, .label-editor { grid-template-columns: 1fr; }
}
@media print {
  html, body { margin: 0; padding: 0; min-width: 0; background: #fff; }
  #workspace { display: none !important; }
  #print-job { display: block; position: static; visibility: visible; }
  #print-job > .paper { break-after: page; }
  #print-job > .paper:last-child { break-after: auto; }
}
