/* Matta brand palette (from sgmatta.com): white & light grey grounds, charcoal, grey body text, Matta crimson accent,
   Gotham-style geometric type in light weights. Gotham is licensed, so it is used only if installed; close fallbacks follow. */
:root {
  --bg: #f4f4f4; --surface: #ffffff; --surface-2: #fafafa; --ink: #252525; --ink-2: #6d6e71; --ink-3: #9a9b9e;
  --line: #e6e6e6; --line-2: #d0d0d0; --brand: #252525; --brand-2: #3e3e3e; --accent: #c02032; --accent-ink: #ffffff; --accent-soft: #fbe9eb;
  --ar: #55565a;
  --ok: #2e7d4f; --ok-soft: #e4f2e9; --warn: #a86800; --warn-soft: #fdf3dc; --bad: #b3261e; --bad-soft: #fbe5e3;
  --info: #2f5f8f; --info-soft: #e6eef6; --muted-soft: #efefef;
  --radius: 4px; --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 10px rgba(0, 0, 0, .04);
  --font: "Gotham", "GothamHTF-Book", "Gotham Book", "Montserrat", "Century Gothic", "Avenir Next", "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 1.7rem; font-weight: 300; margin: 0 0 .35rem; letter-spacing: .005em; }
h1::after { content: ''; display: block; width: 44px; height: 2px; background: var(--accent); margin-top: .4rem; }
.row > h1::after, h1:has(+ .chip)::after { display: none; }
h2 { font-size: 1.12rem; font-weight: 500; margin: 0 0 .6rem; letter-spacing: .01em; }
h3 { font-size: 1rem; font-weight: 500; margin: 0 0 .4rem; }
.muted { color: var(--ink-2); } .small { font-size: .85rem; } .tiny { font-size: .76rem; color: var(--ink-3); }
.mono { font-variant-numeric: tabular-nums; }
.booting { padding: 3rem; text-align: center; color: var(--ink-2); }

/* ----- layout ----- */
/* Top banner with the Matta logo; the menu button (☰) shows on phones/tablets only. */
:root { --topbar-h: 64px; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: .75rem; background: var(--brand); border-bottom: 1px solid #000; color: #fff;
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 1rem 0; }
.topbar .logo { display: flex; align-items: center; height: 100%; }
.topbar .logo img { height: 44px; width: auto; display: block; }
.menu-btn { display: none; position: relative; border: 0; background: none; font-size: 1.7rem; line-height: 1; padding: .4rem .55rem; cursor: pointer; color: #fff; border-radius: 4px; }
.menu-btn:hover { background: var(--brand-2); }
.menu-btn .dot { position: absolute; top: .35rem; right: .3rem; width: .6rem; height: .6rem; border-radius: 50%; background: var(--bad); }
.scrim { display: none; }
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: calc(100vh - var(--topbar-h)); }
.side { background: var(--brand); color: #e9e9e9; padding: 1rem .75rem 1rem; position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  height: calc(100vh - var(--topbar-h) - env(safe-area-inset-top, 0px)); overflow-y: auto; display: flex; flex-direction: column; gap: .2rem; }
.side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; padding: 0 .6rem .9rem; }
.side-head small { font-weight: 300; color: #b5b5b5; font-size: .76rem; letter-spacing: .02em; line-height: 1.3; }
.menu-close { display: none; border: 0; background: none; color: #fff; font-size: 1.3rem; cursor: pointer; padding: .1rem .3rem; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: .5rem; color: #e2e2e2; text-decoration: none; padding: .55rem .7rem; border-radius: 2px; font-weight: 400; border-inline-start: 3px solid transparent; }
.nav a:hover { background: var(--brand-2); color: #fff; }
.nav a.active { background: var(--brand-2); color: #fff; border-inline-start-color: var(--accent); font-weight: 500; }
.nav .count { background: var(--bad); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; min-width: 1.3rem; text-align: center; }
.side .who { margin-top: auto; padding: .75rem .6rem 0; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .85rem; }
.side .who button { margin-top: .5rem; }
.main { padding: 1.25rem 1.5rem 4rem; min-width: 0; }
.topline { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.demo-banner { background: var(--warn-soft); border: 1px solid #ecd9a8; color: #6d4b00; padding: .4rem .75rem; border-radius: 2px; font-size: .82rem; margin-bottom: 1rem; }

/* Phones and tablets: the menu slides in from the left when ☰ is tapped and closes after a choice. */
@media (max-width: 900px) {
  :root { --topbar-h: 58px; }
  .topbar .logo img { height: 36px; }
  .menu-btn { display: block; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; z-index: 60; width: min(300px, 86vw); height: 100%;
    padding-top: calc(1rem + env(safe-area-inset-top, 0px)); padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-102%); transition: transform .22s ease, visibility .22s; visibility: hidden; }
  .menu-close { display: block; }
  .nav a { padding: .75rem .7rem; font-size: 1rem; }
  body.menu-open .side { transform: none; visibility: visible; box-shadow: 0 0 30px rgba(0, 0, 0, .35); }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(20, 20, 20, .45); }
  body.menu-open { overflow: hidden; }
  .main { padding: 1rem 1rem 4rem; }
}
@media print { .topbar, .scrim { display: none !important; } }

/* ----- components ----- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.card + .card, .stack > * + * { margin-top: .9rem; }
.grid { display: grid; gap: .9rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; border: 1px solid var(--ink); background: var(--surface); padding: .5rem 1rem; border-radius: 2px; cursor: pointer;
  font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; text-decoration: none; color: var(--ink); min-height: 40px; }
.btn .ar { text-transform: none; letter-spacing: 0; font-size: 1.05em; }
.btn:hover { background: var(--ink); color: #fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #a51b2b; border-color: #a51b2b; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { filter: brightness(1.08); }
.btn.big { min-height: 52px; padding: .7rem 1.3rem; font-size: .92rem; }
.btn.sm { min-height: 32px; padding: .25rem .65rem; font-size: .72rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--muted-soft); color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); } .chip.info { background: var(--info-soft); color: var(--info); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.st-draft { background: var(--muted-soft); color: var(--ink-2); }
.st-submitted, .st-under_review { background: var(--info-soft); color: var(--info); }
.st-needs_clarification, .st-on_hold { background: var(--warn-soft); color: var(--warn); }
.st-approved, .st-scheduled { background: var(--accent-soft); color: var(--accent); }
.st-in_production, .st-quality_check { background: #ece6f7; color: #5b3f99; }
.st-ready_for_delivery, .st-delivered { background: var(--ok-soft); color: var(--ok); }
.st-cancelled { background: var(--bad-soft); color: var(--bad); }
.banner { border-radius: var(--radius); padding: .7rem .9rem; border: 1px solid; margin-bottom: .9rem; }
.banner.bad { background: var(--bad-soft); border-color: #eec2be; color: #7f1d17; }
.banner.warn { background: var(--warn-soft); border-color: #edd7a6; color: #6d4b00; }
.banner.info { background: var(--info-soft); border-color: #c4d8ec; color: #1f466d; }
.banner.ok { background: var(--ok-soft); border-color: #bfe0cb; color: #1f5a37; }
.banner strong { display: block; margin-bottom: .15rem; }
.blockers { list-style: none; padding: 0; margin: .4rem 0 0; display: grid; gap: .3rem; }
.blockers li { background: var(--bad-soft); color: #7f1d17; border-radius: 6px; padding: .3rem .55rem; font-size: .86rem; }
.blockers li.soft { background: var(--warn-soft); color: #6d4b00; }

/* forms */
label.f { display: grid; gap: .25rem; font-weight: 600; font-size: .86rem; color: var(--ink-2); }
.ar { font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Geeza Pro", Arial, sans-serif; font-weight: 600; color: var(--ar); unicode-bidi: isolate; text-transform: none; letter-spacing: 0; }
h1 .ar, h2 .ar { font-size: .85em; margin-inline-start: .35rem; }
label.f > .lbl { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .1rem .6rem; }
label.f .hint .ar { font-weight: 400; color: var(--ink-3); }
input.readonly { background: var(--surface-2); color: var(--ink-2); font-weight: 700; }
label.f .hint { font-weight: 400; color: var(--ink-3); font-size: .78rem; }
input[type=text], input[type=tel], input[type=date], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: 8px; padding: .5rem .6rem; background: #fff; min-height: 40px; color: var(--ink); }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(192, 32, 50, .25); outline-offset: 0; border-color: var(--ink); }
.invalid input, .invalid textarea, .invalid select, input.invalid { border-color: var(--bad); background: #fff8f7; }
.fieldgrid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.hdrgrid { display: grid; gap: .9rem 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fabgrid { display: grid; gap: .9rem 1rem; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; }
@media (max-width: 1100px) { .fabgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .fabgrid { grid-template-columns: 1fr; } }
.fabgrid > label.f { display: flex; flex-direction: column; gap: .25rem; }
.fabgrid > label.f > input, .fabgrid > label.f > select, .fabgrid > label.f > .combo { margin-top: auto; }
.combo { position: relative; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 2px); margin: 0; padding: .25rem; list-style: none; background: #fff;
  border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 8px 24px rgba(30, 20, 10, .15); max-height: 300px; overflow-y: auto; font-weight: 400; color: var(--ink); }
.combo-list li { padding: .45rem .55rem; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.combo-list li.on, .combo-list li:hover { background: var(--accent-soft); }
.combo-list li.none { color: var(--ink-3); cursor: default; }
.hdrgrid > label.f > .combo { margin-top: auto; }
.docref { display: flex; gap: .4rem; margin-top: auto; }
.docref select { flex: 0 0 42%; } .docref input { flex: 1; min-width: 0; }
.hdrgrid > label.f { display: flex; flex-direction: column; gap: .25rem; }
.hdrgrid > label.f > input, .hdrgrid > label.f > select { margin-top: auto; }
@media (max-width: 760px) { .hdrgrid { grid-template-columns: 1fr; } }
.fieldgrid .wide { grid-column: 1 / -1; }
.typepick { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .5rem; }
.typepick label { border: 1px solid var(--line-2); border-radius: 10px; padding: .6rem .75rem; cursor: pointer; display: flex; gap: .55rem; align-items: flex-start; background: #fff; }
.typepick label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.typepick b { display: block; }
.typepick span { font-size: .8rem; color: var(--ink-2); }
.checkbox { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
.checkbox input { width: 20px; height: 20px; }
.errlist { margin: .25rem 0 0; padding-inline-start: 1.2rem; }
fieldset { border: 0; padding: 0; margin: 0; }

/* tables */
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th { text-align: start; color: var(--ink-3); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; padding: .45rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--surface-2); }
@media (max-width: 760px) {
  table.t.cards thead { display: none; }
  table.t.cards tr { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .6rem; padding: .4rem .2rem; }
  table.t.cards td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .25rem .6rem; text-align: end; }
  table.t.cards td::before { content: attr(data-l); color: var(--ink-3); font-size: .78rem; text-align: start; font-weight: 600; }
}

/* specs */
.spec { display: grid; grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr); gap: .45rem 1rem; margin: 0; }
/* Bilingual layout: in narrow label/heading spots the Arabic sits on its own line under the English. */
.spec dt .ar, .spec dd > .ar, th .ar, .kpi .l .ar, .caprow .ar, .legend .ar, .day-h .ar, .alloc .ar, .tiny > .ar, .hint > .ar { display: block; }
.ar { margin-inline-start: .3em; }
.btn .ar, .chip .ar, .nav a .ar, .toast .ar, .banner .ar, .kpi .ar, .side .ar, .sheet .ar { color: inherit; }
.nav a .ar { opacity: .85; }
th .ar, .spec dt .ar { margin-inline-start: 0; font-weight: 600; text-transform: none; letter-spacing: 0; }
.spec dt { color: var(--ink-3); font-size: .82rem; font-weight: 600; padding-top: .1rem; }
.spec dd { margin: 0; font-size: .98rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.dims { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; }
.item-card { border-inline-start: 4px solid var(--accent); }
.item-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.item-head h3 { margin: 0; font-size: 1.08rem; }
.diff { background: var(--warn-soft); border: 1px solid #edd7a6; border-radius: 8px; padding: .6rem .75rem; }
.diff table { font-size: .88rem; border-collapse: collapse; }
.diff td { padding: .15rem .5rem .15rem 0; vertical-align: top; }
.diff del { color: var(--bad); } .diff ins { color: var(--ok); text-decoration: none; font-weight: 700; }

/* photos */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.gallery.big { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.thumb { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .pdf { font-weight: 800; color: var(--bad); font-size: 1.2rem; text-align: center; padding: .5rem; }
.thumb .pdf small { display: block; color: var(--ink-2); font-weight: 500; font-size: .72rem; word-break: break-all; }
.thumb .cap { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(20, 15, 10, .62); color: #fff; font-size: .7rem; padding: .15rem .35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb .tag { position: absolute; top: .3rem; left: .3rem; }
.thumb .x { position: absolute; top: .25rem; right: .25rem; background: rgba(255, 255, 255, .9); border: 0; border-radius: 6px; cursor: pointer; padding: .1rem .4rem; font-weight: 700; color: var(--bad); }
.mini-thumb { width: 64px; height: 48px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); flex: none; }
.uploader { border: 2px dashed var(--line-2); border-radius: 10px; padding: .75rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; background: var(--surface-2); }
dialog#lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
dialog#lightbox::backdrop { background: rgba(10, 8, 6, .85); }
dialog#lightbox img { max-width: 96vw; max-height: 88vh; display: block; border-radius: 8px; }
dialog#lightbox iframe { width: min(1000px, 94vw); height: 86vh; border: 0; background: #fff; border-radius: 8px; }
dialog#lightbox .lb-bar { display: flex; justify-content: space-between; gap: 1rem; color: #fff; padding: .4rem 0; }

/* modal */
dialog#modal { border: 0; border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog#modal::backdrop { background: rgba(30, 24, 18, .45); }
.modal-h { padding: 1rem 1.1rem .5rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.modal-b { padding: .25rem 1.1rem 1rem; display: grid; gap: .75rem; }
.modal-f { padding: .75rem 1.1rem 1rem; display: flex; justify-content: flex-end; gap: .5rem; border-top: 1px solid var(--line); background: var(--surface-2); position: sticky; bottom: 0; }
.modal-err { display: none; } .modal-err.show { display: block; }

/* toasts */
#toasts { position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); display: grid; gap: .5rem; z-index: 100; max-width: min(420px, calc(100vw - 2rem)); }
.toast { background: var(--brand); color: #fff; padding: .7rem .9rem; border-radius: 10px; box-shadow: var(--shadow); font-size: .92rem; }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }
.toast a { color: #ffe0b8; }

/* KPI & capacity */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .9rem; text-decoration: none; color: inherit; display: block; }
.kpi .n { font-size: 1.7rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--ink-2); font-size: .82rem; }
.kpi.bad .n { color: var(--bad); } .kpi.warn .n { color: var(--warn); }
.capbar { height: 10px; background: var(--muted-soft); border-radius: 999px; overflow: hidden; position: relative; }
.capbar > i { display: block; height: 100%; background: var(--brand-2); border-radius: 999px; }
.capbar.full > i { background: var(--warn); } .capbar.over > i { background: var(--bad); }
.caprow { display: grid; grid-template-columns: 6.5rem 1fr 7.5rem; gap: .6rem; align-items: center; font-size: .86rem; padding: .2rem 0; }
.progress { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--muted-soft); }
.progress .acc { background: var(--ok); } .progress .prod { background: #9b85cc; } .progress .alloc { background: #c9c9cc; }
.legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .78rem; color: var(--ink-2); margin-top: .3rem; }
.legend i { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-inline-end: .25rem; vertical-align: -1px; }

/* schedule */
.sched { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .sched { grid-template-columns: 1fr; } }
.week { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; min-height: 140px; display: flex; flex-direction: column; gap: .45rem; }
.day.off { background: repeating-linear-gradient(-45deg, #f2f2f2, #f2f2f2 8px, #e9e9e9 8px, #e9e9e9 16px); }
.day.today { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.day.over { border-color: var(--bad); }
.day-h { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.day-h b { font-size: .95rem; }
.alloc { border: 1px solid var(--line); border-radius: 8px; padding: .45rem .5rem; background: var(--surface-2); font-size: .84rem; display: grid; gap: .2rem; }
.alloc.blocked { border-color: #eec2be; background: #fff7f6; }
.alloc.rework { border-style: dashed; border-color: #b9a2e0; }
.alloc.conflict { box-shadow: inset 3px 0 0 var(--bad); }
.alloc.closed { opacity: .7; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; }
.month .mh { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 0 .3rem; }
.mday { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 96px; padding: .35rem; display: flex; flex-direction: column; gap: .35rem; }
.mday.empty { background: transparent; border-style: dashed; }
.mday.today { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.mday .mnum { font-weight: 600; font-size: .85rem; color: var(--ink-2); }
@media (max-width: 900px) {
  .month { grid-template-columns: 1fr; }
  .month .mh, .mday.empty, .mday:not(.has):not(.today) { display: none; }
}
a.alloc.deliv { text-decoration: none; color: inherit; border-inline-start: 3px solid var(--line-2); }
a.alloc.deliv:hover { border-color: var(--ink); }
.alloc.deliv.late, .alloc.deliv.at_risk { border-inline-start-color: var(--bad); background: #fff7f6; }
.alloc.deliv.ready, .alloc.deliv.on_track { border-inline-start-color: var(--ok); }
.alloc.deliv.not_scheduled, .alloc.deliv.on_hold { border-inline-start-color: var(--warn); }
.alloc.deliv.delivered { opacity: .6; }
.alloc .t { display: flex; justify-content: space-between; gap: .4rem; font-weight: 700; }
.alloc a { text-decoration: none; }
.queue-item { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.queue-item:last-child { border-bottom: 0; }

/* today (factory phone) */
.work { display: grid; gap: .8rem; }
.job { display: grid; grid-template-columns: 140px 1fr; gap: .9rem; }
@media (max-width: 560px) { .job { grid-template-columns: 1fr; } .job .thumb { aspect-ratio: 16 / 9; } }
.job .acts { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.qty-step { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.qty-step button { border: 0; background: var(--surface-2); width: 44px; height: 44px; font-size: 1.3rem; cursor: pointer; }
.qty-step input { width: 64px; text-align: center; border: 0; border-radius: 0; min-height: 44px; font-size: 1.1rem; font-weight: 700; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.timeline li { border-inline-start: 3px solid var(--line-2); padding: .1rem 0; padding-inline-start: .7rem; font-size: .88rem; }
.timeline li.req { border-color: var(--warn); } .timeline li.rep { border-color: var(--info); }
.timeline .meta { color: var(--ink-3); font-size: .76rem; }
details > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); padding: .25rem 0; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs a { padding: .5rem .8rem; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; font-weight: 600; }
.tabs a.active { color: var(--ink); border-color: var(--accent); }
.empty { color: var(--ink-3); padding: 1rem 0; text-align: center; }
.notif { display: flex; gap: .75rem; padding: .7rem .2rem; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.notif.unread { font-weight: 600; }
.notif.unread::before { content: ''; width: 8px; height: 8px; margin-top: .45rem; border-radius: 50%; background: var(--accent); flex: none; }
.notif:not(.unread)::before { content: ''; width: 8px; flex: none; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login .card { width: min(400px, 100%); padding: 1.5rem; }

/* job sheet (print) */
.sheet { background: #fff; max-width: 900px; margin: 0 auto; padding: 1.5rem; border: 1px solid var(--line); }
.sheet h1 { font-size: 1.6rem; }
.sheet .item { border-top: 2px solid #222; padding-top: .8rem; margin-top: 1rem; page-break-inside: avoid; }
.sheet .sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.5rem; }
.sheet .sign div { border-top: 1px solid #555; padding-top: .3rem; font-size: .8rem; }
.sheet .photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.sheet .photos img { width: 100%; max-height: 180px; object-fit: contain; border: 1px solid #ccc; }
@media print {
  body { background: #fff; }
  .side, .no-print, #toasts { display: none !important; }
  .shell { display: block; } .main { padding: 0; }
  .sheet { border: 0; padding: 0; max-width: none; }
  a { color: inherit; text-decoration: none; }
}

/* Phone notifications: invitation banner and settings card */
.push-prompt { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; background: #fff; border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); margin-bottom: 1rem; }
.push-prompt span { flex: 1 1 14rem; }
.push-card { margin-bottom: 1rem; }
.push-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.push-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* On/off switch (phone notifications) */
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex: 0 0 auto; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider { position: absolute; inset: 0; background: var(--line-2); border-radius: 30px; transition: background .2s; }
.switch .slider::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(22px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch.off-limits { opacity: .45; cursor: not-allowed; }
/* ----- language: English or Arabic (one at a time), chosen with the button at the top right ----- */
.lang-btn { margin-inline-start: auto; border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 999px; padding: .3rem .85rem; font: 600 .9rem/1.2 "Segoe UI", Tahoma, "Geeza Pro", Arial, sans-serif; cursor: pointer; white-space: nowrap; }
.lang-btn:hover { background: var(--brand-2); border-color: var(--brand-2); }
/* On the charcoal banner the button is a light outline; on the white sign-in card it stays charcoal. */
.topbar .lang-btn { background: transparent; border-color: rgba(255, 255, 255, .5); }
.topbar .lang-btn:hover { background: var(--brand-2); border-color: #fff; }
.login .card { position: relative; padding-top: 3.25rem; }
.login .lang-btn { position: absolute; top: .75rem; right: .75rem; }
/* The top bar keeps the same layout in both languages: ☰ and logo on the left, language on the right. */
.topbar { direction: ltr; }
.switch { direction: ltr; }
html[lang=ar] body { font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Geeza Pro", Arial, sans-serif; }
html[lang=ar] .btn, html[lang=ar] table.t th { text-transform: none; letter-spacing: 0; }
html[lang=ar] h1 { font-weight: 600; }

/* ----- no zooming on phones: inputs at 16px stop iPhone's automatic zoom when a box is tapped ----- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
@media (max-width: 900px) {
  input, select, textarea { font-size: 16px !important; }
  body { overflow-x: clip; }
}
/* "+ New order" stands out in the menu (owner, 19 Oct 2026). */
.nav a[data-nav="orders/new"] { font-size: 1.15rem; font-weight: 600; color: #fff; }
@media (max-width: 900px) { .nav a[data-nav="orders/new"] { font-size: 1.25rem; } }
