/* J360 operations system. Light, high-contrast, big touch targets. Brand: amber #FFB020 on near-black. */
:root {
  --ink: #15171a; --ink-2: #4a5059; --line: #dcd9d2; --paper: #f4f2ed; --card: #fff; --bar: #0a0b0d;
  --amber: #ffb020; --amber-d: #e09600; --amber-bg: #fff3d6;
  --green: #17803d; --green-bg: #e3f4e8; --red: #c62828; --red-bg: #fdeaea; --blue: #1f5fbf; --blue-bg: #e6eefb;
  --violet: #6a3fb5; --violet-bg: #efe9fa; --gray: #5f6670; --gray-bg: #eceae5;
  --r: 10px; --gap: 14px; --tap: 52px;
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 17px/1.5 var(--font); color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
.boot { padding: 40px; text-align: center; color: var(--gray); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* ---------- shell ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--bar); color: #fff; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); min-height: 58px; }
.top .mark { width: 32px; height: 32px; flex: none; }
.top .title { font-weight: 700; font-size: 1.05rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back { background: none; border: 0; color: #fff; min-width: 44px; min-height: 44px; display: grid; place-items: center; border-radius: 8px; cursor: pointer; }
.top .chip-btn { background: #23262b; color: #fff; border: 1px solid #3a3f46; border-radius: 8px; padding: 6px 12px; min-height: 40px; cursor: pointer; font-size: .9rem; }
.sample { background: var(--amber-bg); color: #5a3d00; font-size: .85rem; padding: 6px 14px; border-bottom: 1px solid #f0d9a0; }
main { padding: 16px 14px 110px; max-width: 980px; margin: 0 auto; }
.nav { position: fixed; bottom: 0; inset-inline: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); display: grid;
  grid-auto-flow: column; grid-auto-columns: 1fr; padding-bottom: env(safe-area-inset-bottom); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 9px; min-height: 64px; color: var(--ink-2);
  text-decoration: none; font-size: .78rem; font-weight: 500; }
.nav a svg { width: 26px; height: 26px; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 700; box-shadow: inset 0 3px 0 var(--amber); }
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 220px 1fr; }
  .nav { position: sticky; top: 58px; height: calc(100vh - 58px); grid-auto-flow: row; grid-auto-rows: min-content; align-content: start;
    border-top: 0; border-inline-end: 1px solid var(--line); padding: 12px 10px; gap: 4px; }
  .nav a { flex-direction: row; gap: 12px; font-size: 1rem; padding: 12px 14px; min-height: 52px; border-radius: 8px; }
  .nav a[aria-current="page"] { box-shadow: none; background: var(--amber-bg); }
  main { padding: 24px 28px 60px; }
}

/* ---------- building blocks ---------- */
.stack > * + * { margin-top: var(--gap); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.muted { color: var(--ink-2); }
.small { font-size: .88rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 10px; }
.empty { text-align: center; color: var(--ink-2); padding: 22px 10px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--r); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 10px 18px; border-radius: var(--r);
  border: 1px solid var(--line); background: #fff; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn:hover { border-color: #b9b5ac; }
.btn.primary { background: var(--amber); border-color: var(--amber-d); color: #111; }
.btn.primary:hover { background: #ffbb3d; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--red); border-color: #e9b8b8; }
.btn.block { width: 100%; }
.btn.big { min-height: 64px; font-size: 1.1rem; }
.btn.sm { min-height: 40px; padding: 6px 12px; font-size: .92rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--blue); cursor: pointer; padding: 8px 4px; font-weight: 600; min-height: 40px; }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 112px; padding: 12px 6px;
  border-radius: var(--r); background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; text-align: center; font-size: 1rem; }
.action svg { width: 36px; height: 36px; }
.action.main { background: var(--amber); border-color: var(--amber-d); }

/* status pill */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.s-inquiry { background: var(--gray-bg); color: var(--gray); }
.s-quoted { background: var(--blue-bg); color: var(--blue); }
.s-confirmed { background: var(--green-bg); color: var(--green); }
.s-out { background: var(--amber-bg); color: #8a5a00; }
.s-returned { background: var(--violet-bg); color: var(--violet); }
.s-closed { background: var(--gray-bg); color: #3a3f46; }
.s-cancelled { background: var(--red-bg); color: var(--red); }

/* list rows (events, gear) */
.list { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px; text-decoration: none; color: var(--ink); min-height: 64px; }
.item:hover { border-color: #b9b5ac; }
.item .t { font-weight: 700; }
.item .sub { color: var(--ink-2); font-size: .9rem; grid-column: 1 / -1; }
.datebox { width: 54px; text-align: center; border-radius: 8px; background: var(--paper); padding: 4px 0; line-height: 1.15; }
.datebox b { display: block; font-size: 1.3rem; }
.datebox span { font-size: .75rem; color: var(--ink-2); }
.item.with-date { grid-template-columns: auto 1fr auto; }
.item.with-date .sub { grid-column: 2 / -1; }

.alert { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r); text-decoration: none; color: var(--ink); font-weight: 600; min-height: 56px; }
.alert svg { width: 24px; height: 24px; flex: none; }
.alert.red { background: var(--red-bg); color: #7a1212; }
.alert.amber { background: var(--amber-bg); color: #5a3d00; }
.alert.gray { background: var(--gray-bg); }

/* chips / filters */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 16px; min-height: 44px; cursor: pointer; font-weight: 600; font-size: .95rem; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--gray-bg); border-radius: var(--r); padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; border-radius: 8px; min-height: 48px; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* forms */
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: .95rem; }
.input, select.input, textarea.input { width: 100%; min-height: var(--tap); border: 1.5px solid #c9c5bc; border-radius: var(--r); padding: 10px 12px; background: #fff; }
textarea.input { min-height: 90px; }
.input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--amber-bg); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .grid2.stack-sm { grid-template-columns: 1fr; } }
.check { display: flex; gap: 12px; align-items: center; min-height: var(--tap); padding: 8px 12px; border: 1.5px solid #c9c5bc; border-radius: var(--r); background: #fff; cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--ink); }
.radio-cards { display: grid; gap: 8px; }
.radio-cards label { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1.5px solid #c9c5bc; border-radius: var(--r); background: #fff; cursor: pointer; min-height: var(--tap); }
.radio-cards input { width: 22px; height: 22px; accent-color: var(--ink); }
.radio-cards label:has(input:checked) { border-color: var(--ink); background: var(--amber-bg); }
.err { color: var(--red); font-weight: 600; }

/* wizard */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 16px; }
.steps div { text-align: center; font-size: .85rem; font-weight: 600; color: var(--ink-2); padding-top: 8px; border-top: 4px solid var(--line); }
.steps div.on { color: var(--ink); border-color: var(--amber); }
.steps div.done { color: var(--ink); border-color: var(--ink); }
.sticky-foot { position: fixed; bottom: 64px; inset-inline: 0; z-index: 25; background: #fff; border-top: 1px solid var(--line); padding: 10px 14px;
  display: flex; gap: 10px; align-items: center; box-shadow: 0 -4px 14px rgba(0,0,0,.06); }
.sticky-foot .sum { flex: 1; font-weight: 600; line-height: 1.3; }
@media (min-width: 900px) { .sticky-foot { inset-inline-start: 220px; bottom: 0; } }

.gear-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.gear-row.picked { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--amber); }
[dir="rtl"] .gear-row.picked { box-shadow: inset -4px 0 0 var(--amber); }
.gear-row .name { font-weight: 600; }
.gear-row .meta { font-size: .88rem; grid-column: 1 / -1; }
.ok-txt { color: var(--green); font-weight: 600; }
.bad-txt { color: var(--red); font-weight: 700; }
.stepper { display: flex; align-items: center; border: 1.5px solid #c9c5bc; border-radius: var(--r); overflow: hidden; background: #fff; }
.stepper button { width: 48px; height: 48px; border: 0; background: var(--paper); font-size: 1.5rem; font-weight: 700; cursor: pointer; }
.stepper input { width: 58px; height: 48px; border: 0; text-align: center; font-weight: 700; font-size: 1.1rem; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

.kit-btn { border: 1.5px dashed #b9b5ac; background: #fff; border-radius: var(--r); padding: 10px 14px; min-height: var(--tap); cursor: pointer; font-weight: 600; text-align: start; }

/* event page */
.ev-head { display: grid; gap: 8px; }
.progress { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 4px 0 2px; }
.progress div { height: 8px; border-radius: 4px; background: var(--line); }
.progress div.done { background: var(--ink); }
.progress div.now { background: var(--amber); }
.facts { display: grid; gap: 10px; }
.fact { display: flex; gap: 12px; align-items: flex-start; }
.fact svg { width: 22px; height: 22px; flex: none; margin-top: 3px; color: var(--ink-2); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.table th { font-size: .85rem; color: var(--ink-2); font-weight: 600; }
.table td.n, .table th.n { text-align: end; white-space: nowrap; }
.totals { display: grid; gap: 6px; }
.totals .spread { padding: 2px 0; }
.totals .grand { font-size: 1.25rem; font-weight: 700; border-top: 2px solid var(--ink); padding-top: 8px; margin-top: 4px; }
.bar { height: 10px; background: var(--gray-bg); border-radius: 5px; overflow: hidden; }
.bar > div { height: 100%; background: var(--green); }
.warn-box { background: var(--red-bg); border: 1px solid #f0c0c0; color: #6e1010; border-radius: var(--r); padding: 12px 14px; }

/* scan */
.scan-video { position: relative; background: #000; border-radius: var(--r); overflow: hidden; aspect-ratio: 4/3; max-height: 50vh; width: 100%; }
.scan-video video { width: 100%; height: 100%; object-fit: cover; }
.scan-video .frame { position: absolute; inset: 18% 22%; border: 3px solid var(--amber); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.feed { display: grid; gap: 8px; }
.feed .res { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r); font-weight: 600; }
.feed .res svg { width: 28px; height: 28px; flex: none; }
.feed .res.good { background: var(--green-bg); color: #0d4a24; }
.feed .res.bad { background: var(--red-bg); color: #6e1010; }
.feed .res.info { background: var(--gray-bg); }
.flash-good { animation: fg .5s; } .flash-bad { animation: fb .5s; }
@keyframes fg { from { background: #b6e8c6; } } @keyframes fb { from { background: #f6b9b9; } }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: .78rem; color: var(--ink-2); font-weight: 600; padding: 4px 0; }
.cal .day { background: #fff; border: 1px solid var(--line); border-radius: 8px; min-height: 76px; padding: 4px; font-size: .75rem; overflow: hidden; }
.cal .day.other { background: transparent; border-color: transparent; }
.cal .day.today { border: 2px solid var(--amber); }
.cal .day b { display: block; font-size: .85rem; margin-bottom: 2px; }
.cal .ev { display: block; border-radius: 4px; padding: 1px 4px; margin-bottom: 2px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }

/* login */
.login { min-height: 100vh; display: grid; place-items: start center; padding: 40px 16px; background: var(--bar); color: #fff; }
.login .box { width: 100%; max-width: 420px; }
.login .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login .logo img { width: 52px; height: 52px; }
.login .who { display: grid; gap: 10px; }
.login .who button { display: flex; align-items: center; gap: 14px; text-align: start; min-height: 64px; padding: 10px 16px; border-radius: var(--r);
  border: 1px solid #333840; background: #16181c; color: #fff; cursor: pointer; font-size: 1.05rem; font-weight: 600; }
.login .who button small { display: block; color: #a9b0ba; font-weight: 400; font-size: .85rem; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--amber); color: #111; display: grid; place-items: center; font-weight: 700; flex: none; }
.dots { display: flex; gap: 16px; justify-content: center; margin: 22px 0; }
.dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #8a919b; }
.dots span.on { background: var(--amber); border-color: var(--amber); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; direction: ltr; }
.keypad button { min-height: 68px; border-radius: var(--r); border: 1px solid #333840; background: #16181c; color: #fff; font-size: 1.6rem; font-weight: 600; cursor: pointer; }
.keypad button:active { background: #2a2e34; }
.login .msg { min-height: 28px; text-align: center; color: #ffb4b4; font-weight: 600; }
.login .lang { position: absolute; top: 16px; inset-inline-end: 16px; }

/* dialogs */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px); }
dialog::backdrop { background: rgba(10,11,13,.55); }
dialog .dlg { padding: 18px; }
dialog .dlg-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; }

#toast { position: fixed; bottom: 90px; inset-inline: 16px; z-index: 100; display: grid; justify-items: center; pointer-events: none; }
#toast div { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--r); font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
#toast div.bad { background: var(--red); }

/* print: quote / labels */
.paper { background: #fff; max-width: 820px; margin: 0 auto; padding: 32px; border: 1px solid var(--line); }
.paper .ph { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 3px solid var(--bar); padding-bottom: 14px; margin-bottom: 18px; }
.paper .ph img { height: 46px; }
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.label { border: 1px dashed #999; padding: 8px; text-align: center; break-inside: avoid; background: #fff; }
.label svg { width: 110px; height: 110px; }
.label b { display: block; font-size: 1rem; direction: ltr; }
.label span { font-size: .72rem; }
@media print {
  body { background: #fff; }
  .top, .nav, .sample, .no-print, #toast { display: none !important; }
  .shell { display: block; }
  main { padding: 0; max-width: none; }
  .paper { border: 0; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
[dir="rtl"] .flip, [dir="ltr"] .noflip { transform: scaleX(-1); }
.login { position: relative; }
.btn svg.flip, .btn svg.noflip { width: 22px; height: 22px; }
/* fixes after first screenshots */
svg { width: 22px; height: 22px; flex: none; }
.action svg { width: 36px; height: 36px; }
.nav a svg { width: 26px; height: 26px; }
.label svg { width: 110px; height: 110px; }
.feed .res svg { width: 28px; height: 28px; }
#toast { top: 72px; bottom: auto; }
.table-wrap { overflow-x: auto; }
@media (max-width: 600px) {
  .paper { padding: 16px 12px; }
  .paper .ph { flex-wrap: wrap; }
  .paper .ph > div:last-child { text-align: start !important; }
  .paper .table { font-size: .85rem; }
  .paper .table th, .paper .table td { padding: 8px 4px; }
}
/* v2: order sections, rows, tiles, statements */
.sec .card.rows { padding: 6px 14px 10px; }
.row-btn { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; text-align: start; background: none; border: 0;
  border-bottom: 1px solid var(--line); padding: 12px 2px; min-height: 52px; cursor: pointer; color: var(--ink); font: inherit; }
.row-btn:disabled { cursor: default; }
.row-btn.static { cursor: default; }
.row-btn:not(:disabled):not(.static):hover { background: var(--paper); }
.row-btn .l { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.row-btn .l svg { display: inline; vertical-align: -5px; }
.row-btn .r { font-weight: 600; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.row-btn .d { font-weight: 400; }
.grp + .grp { margin-top: 10px; }
.grp-h { padding: 8px 0 2px; }
.total-row { padding: 8px 2px 2px; }
.tiles4 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 700px) { .tiles4 { grid-template-columns: repeat(4, 1fr); } }
.tile b { display: block; font-size: 1.25rem; margin-top: 2px; }
a.tile.link { text-decoration: none; color: var(--ink); }
.balance-card b { display: block; font-size: 2rem; margin: 2px 0 4px; }
.line-edit { display: grid; grid-template-columns: 1fr 120px auto; gap: 8px; align-items: center; }
@media (max-width: 480px) { .line-edit { grid-template-columns: 1fr 96px auto; } }
.radio-cards.inline { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.grand-card { font-size: 1.2rem; }
input[type=number].num { text-align: start; }
.grp-h .btn { white-space: nowrap; }
