/* Eseed Mobile — app styles
   Palette from the repair bench: solder-mask green, gold pads, silkscreen paper. */
@font-face { font-family: 'Plex Arabic'; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Plex Arabic'; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Plex Arabic'; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Plex Arabic'; font-weight: 700; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Plex Arabic'; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+20AA, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex Arabic'; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+20AA, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex Arabic'; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+20AA, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex Arabic'; font-weight: 700; font-display: swap; src: url(/fonts/ibm-plex-sans-arabic-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+20AA, U+FEFF, U+FFFD; }

:root {
  --board: #0D3a2B;
  --board-2: #124A37;
  --board-3: #1A5C45;
  --mask: #19694D;
  --mask-ink: #0F4D38;
  --mask-soft: #E4F0EA;
  --gold: #E2AE36;
  --gold-2: #F3D27A;
  --gold-ink: #7A5A0E;
  --gold-soft: #FBF1D8;
  --paper: #F2F4F1;
  --surface: #FFFFFF;
  --surface-2: #F8FAF8;
  --ink: #14211B;
  --ink-2: #44554D;
  --ink-3: #7A8983;
  --line: #E1E6E2;
  --line-2: #CFD7D2;
  --red: #BE3A26; --red-soft: #FBE9E5;
  --blue: #23609F; --blue-soft: #E5EEF8;
  --teal: #0F7486; --teal-soft: #E1F2F4;
  --violet: #6A4CA3; --violet-soft: #EEE9F7;
  --amber: #A9690B; --amber-soft: #FBF0D9;
  --green: #1C7A50; --green-soft: #E1F2E9;
  --slate: #56645F; --slate-soft: #ECF0EE;
  --r-lg: 14px; --r-md: 10px; --r-sm: 7px;
  --shadow: 0 1px 0 rgba(13, 58, 43, .04), 0 2px 6px -2px rgba(13, 58, 43, .08);
  --shadow-lg: 0 24px 60px -18px rgba(8, 35, 26, .35), 0 2px 8px rgba(8, 35, 26, .08);
  --side: 236px;
  --focus: 0 0 0 3px rgba(226, 174, 54, .45);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Plex Arabic', -apple-system, 'Segoe UI', Tahoma, sans-serif;
  font-size: 14px; line-height: 1.6; color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.2px; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
h4 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
.ic { flex: none; display: block; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.pre { white-space: pre-line; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; } .row.gap-lg { gap: 14px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.red-t { color: var(--red); } .green-t { color: var(--green); } .gold-t { color: var(--gold-ink); }
.money { white-space: nowrap; font-weight: 600; unicode-bidi: isolate; }
.money.pos { color: var(--green); } .money.neg { color: var(--red); }
.hide { display: none !important; }
.full { width: 100%; }
.mt { margin-top: 14px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 14px; }
::selection { background: var(--gold-2); }

/* ---------------- layout ---------------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: var(--side); flex: none; background: var(--board); color: #DCE8E2; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 12px 12px;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.05) 1px, transparent 0); background-size: 18px 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand img { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.brand b { display: block; font-size: 17px; color: #fff; letter-spacing: .2px; line-height: 1.1; }
.brand span { font-size: 11.5px; color: #9FC0B2; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; color: #C3D6CD; font-weight: 500; font-size: 14px;
  position: relative;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: var(--board-3); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.nav a.on::before { content: ''; position: absolute; right: -4px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--gold); }
.nav a .badge { margin-inline-start: auto; background: var(--gold); color: #3A2A04; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 7px; line-height: 19px; }
.nav a .badge.red { background: #E5634D; color: #fff; }
.nav .sep { height: 1px; background: rgba(255,255,255,.08); margin: 8px 6px; }
.nav .group { font-size: 11.5px; color: #7FA392; padding: 10px 12px 4px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 11px; background: rgba(255,255,255,.05); margin-top: 10px; }
.me b { color: #fff; font-size: 13.5px; display: block; line-height: 1.2; }
.me .grow span { font-size: 11.5px; color: #9FC0B2; }
.me .icon-btn { color: #9FC0B2; }
.me .icon-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #3A2A04; display: grid; place-items: center; font-weight: 700; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; background: var(--mask-soft); color: var(--mask-ink); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; background: rgba(242,244,241,.92); backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 10px; padding: 12px 26px; border-bottom: 1px solid var(--line);
}
.page { padding: 22px 26px 60px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-3); margin-top: 4px; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); font-size: 13px; margin-bottom: 6px; }
.back:hover { color: var(--ink); }

/* global search */
.gsearch { position: relative; flex: 1; max-width: 560px; }
.gsearch .search-field { background: var(--surface); }
.gsearch .results { position: absolute; top: calc(100% + 6px); right: 0; left: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; max-height: 70vh; overflow: auto; z-index: 50; }
.gsearch .results h5 { margin: 8px 10px 4px; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
kbd { font-family: inherit; font-size: 11px; background: var(--surface-2); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--ink-3); }

/* ---------------- controls ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .seg button:focus-visible, .chip-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.primary { background: var(--mask); border-color: var(--mask); color: #fff; }
.btn.primary:hover { background: var(--mask-ink); border-color: var(--mask-ink); }
.btn.gold { background: var(--gold); border-color: #CC9A25; color: #2E2103; }
.btn.gold:hover { background: #D7A12C; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(20,33,27,.05); }
.btn.wa { background: #1FA855; border-color: #1FA855; color: #fff; }
.btn.wa:hover { background: #178C46; }
.btn.sm { height: 31px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 9px; color: var(--ink-2); cursor: pointer; flex: none; }
.icon-btn:hover { background: rgba(20,33,27,.06); color: var(--ink); }
.link { background: none; border: 0; padding: 0; color: var(--mask); font: inherit; font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
  height: 38px; padding: 0 11px; min-width: 0;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.6; }
input[type=number] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--mask); }
input::placeholder, textarea::placeholder { color: #A3AFA9; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--mask); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--ink-3); }
.field.req > label::after { content: ' *'; color: var(--red); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .spanall { grid-column: 1 / -1; }
.input-suffix { position: relative; }
.input-suffix input { width: 100%; padding-left: 34px; }
.input-suffix span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 13px; pointer-events: none; }

.search-field { position: relative; display: flex; align-items: center; gap: 8px; height: 38px; border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 0 11px; background: var(--surface); color: var(--ink-3); }
.search-field:focus-within { border-color: var(--mask); box-shadow: var(--focus); }
.search-field input { border: 0; height: 100%; padding: 0; flex: 1; background: transparent; box-shadow: none !important; }
.search-field.big { height: 46px; font-size: 15px; }
.dropdown { position: absolute; top: calc(100% + 5px); right: -1px; left: -1px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 5px; z-index: 60; max-height: 340px; overflow: auto; color: var(--ink); font-size: 14px; }
.dd-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; font: inherit; color: inherit; text-align: right; border-radius: 8px; cursor: pointer; }
.dd-item:hover, .dd-item.on { background: var(--surface-2); }
.dd-item.add { color: var(--mask); font-weight: 600; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; }
.tag-mini { font-size: 11px; color: var(--ink-3); background: var(--slate-soft); border-radius: 5px; padding: 0 6px; }

.seg { display: inline-flex; background: #E6EBE7; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.seg.small button { padding: 5px 10px; font-size: 12.5px; }
.seg button .cnt { font-size: 11px; color: var(--ink-3); margin-inline-start: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid var(--line-2); background: var(--surface); font: inherit; font-size: 13px; border-radius: 99px; padding: 4px 12px; cursor: pointer; color: var(--ink-2); display: inline-flex; align-items: center; gap: 5px; }
.chip-btn:hover { border-color: var(--ink-3); }
.chip-btn.on { background: var(--board); border-color: var(--board); color: #fff; }
.chip-btn.ok { background: var(--green-soft); border-color: #9FD2B6; color: var(--green); }
.chip-btn.bad { background: var(--red-soft); border-color: #EDB0A4; color: var(--red); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 99px; background: var(--slate-soft); color: var(--slate); white-space: nowrap; }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.gold { background: var(--gold-soft); color: var(--gold-ink); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }

.picked { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 6px 10px; background: var(--surface); min-height: 38px; }
.picked b { font-size: 13.5px; }
.onboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.onboard a { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.onboard a:hover { border-color: var(--mask); }
.onboard .n { width: 26px; height: 26px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-ink); display: grid; place-items: center; font-weight: 700; flex: none; font-size: 13px; }
.onboard a.done .n { background: var(--mask); color: #fff; }
.onboard b { display: block; font-size: 13.5px; }
.onboard span { font-size: 12.5px; color: var(--ink-3); }

/* status chips */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 2px 10px 2px 11px; border-radius: 99px; white-space: nowrap; background: var(--slate-soft); color: var(--slate); }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.sm { font-size: 11.5px; padding: 1px 8px; }
.st-received { background: var(--slate-soft); color: var(--slate); }
.st-checking { background: var(--blue-soft); color: var(--blue); }
.st-approval { background: var(--violet-soft); color: var(--violet); }
.st-parts { background: var(--amber-soft); color: var(--amber); }
.st-repairing { background: var(--teal-soft); color: var(--teal); }
.st-ready { background: var(--green-soft); color: var(--green); }
.st-unfixable { background: var(--red-soft); color: var(--red); }
.st-delivered { background: #EEF0EF; color: #6B7772; }
.st-cancelled { background: #F1F1F1; color: #8C8C8C; text-decoration: line-through; }

/* ---------------- panels ---------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 15px; }
.panel-head .actions { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.panel-body { padding: 16px 18px; }
.panel-body.flush { padding: 0; }

.cols { display: grid; gap: 16px; align-items: start; }
.cols.main-side { grid-template-columns: minmax(0, 1fr) 360px; }
.cols.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }

/* inline stat strip (not cards) */
.strip { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; flex-wrap: wrap; }
.strip .st { flex: 1; min-width: 150px; padding: 14px 18px; border-inline-start: 1px solid var(--line); box-shadow: 0 -1px 0 var(--line); }
.strip .st:first-child { border-inline-start: 0; }
.strip .st span { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.strip .st b { display: block; font-size: 21px; font-weight: 700; margin-top: 2px; letter-spacing: -.3px; }
.strip .st small { font-size: 12px; color: var(--ink-3); }
.strip .st.hero { background: var(--board); color: #fff; }
.strip .st.hero span, .strip .st.hero small { color: #A9C8BA; }
.strip .st.hero b { color: var(--gold-2); }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: right; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: #F7FAF8; }
.table td.num, .table th.num { text-align: left; }
.table .dim td { color: var(--ink-3); }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); }
.table input { height: 32px; }
.table-wrap { overflow: auto; }
.cell-title { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--ink-3); }

.empty { text-align: center; padding: 42px 20px; color: var(--ink-3); }
.empty-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--slate-soft); display: grid; place-items: center; margin: 0 auto 12px; color: var(--ink-3); }
.empty h4 { color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.empty p { max-width: 380px; margin: 0 auto 14px; }

/* ---------------- ticket stub (signature element) ---------------- */
.ticket { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); position: relative; transition: border-color .12s, transform .12s; min-width: 0; }
.ticket:hover { border-color: var(--line-2); transform: translateY(-1px); }
.tk-stub {
  width: 86px; flex: none; background: var(--board); color: #fff; border-radius: 0 11px 11px 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 4px; position: relative;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.07) 1px, transparent 0); background-size: 10px 10px;
}
.tk-stub::after { /* perforation */
  content: ''; position: absolute; left: -1px; top: 8px; bottom: 8px; border-left: 2px dashed rgba(255,255,255,0);
  background-image: radial-gradient(circle, var(--paper) 3px, transparent 3.5px); background-size: 8px 12px; width: 8px; transform: translateX(-4px);
}
.tk-label { font-size: 11px; color: #9FC0B2; }
.tk-no { font-size: 23px; font-weight: 700; color: var(--gold-2); letter-spacing: .5px; line-height: 1.15; }
.tk-date { font-size: 10.5px; color: #9FC0B2; margin-top: 2px; }
.tk-body { flex: 1; min-width: 0; padding: 11px 16px 11px 14px; display: flex; flex-direction: column; gap: 4px; }
.tk-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tk-device { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-cust { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.tk-cust .muted { overflow: hidden; text-overflow: ellipsis; }
.tk-cust .muted { font-size: 12px; }
.tk-problem { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-foot { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.tk-meta { display: inline-flex; align-items: center; gap: 4px; }
.tk-meta.money-due { color: var(--gold-ink); font-weight: 600; }
.tk-deadline { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.tk-deadline .bar { flex: 1; height: 4px; border-radius: 4px; background: #EAEFEC; overflow: hidden; max-width: 160px; }
.tk-deadline .bar i { display: block; height: 100%; background: var(--mask); border-radius: 4px; }
.tk-deadline.warn { color: var(--amber); } .tk-deadline.warn .bar i { background: var(--gold); }
.tk-deadline.bad { color: var(--red); font-weight: 600; } .tk-deadline.bad .bar i { background: var(--red); }
.ticket.urgent .tk-stub { background: #6B1F14; }
.ticket.urgent .tk-stub::before { content: 'مستعجل'; position: absolute; top: 6px; font-size: 10px; color: #FFD1C7; }
.ticket.tk-ready .tk-stub, .ticket.tk-unfixable .tk-stub { background: var(--mask); }
.ticket.compact .tk-stub { width: 74px; }
.ticket.compact .tk-no { font-size: 19px; }
.tickets { display: grid; gap: 10px; }
.tickets.two { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

/* board view */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(330px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.board-col { background: #E8ECE9; border-radius: var(--r-lg); padding: 10px; min-height: 120px; }
.board-col h4 { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.board-col h4 .cnt { margin-inline-start: auto; font-size: 12px; color: var(--ink-3); }
.board-col .tickets { gap: 8px; }

/* status stepper */
.stepper { display: flex; gap: 0; overflow-x: auto; }
.step { flex: 1; min-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; border: 0; background: none; font: inherit; cursor: pointer; padding: 4px 2px; color: var(--ink-3); }
.step::before { content: ''; position: absolute; top: 17px; left: 50%; right: -50%; height: 2px; background: var(--line-2); z-index: 0; }
.step:first-child::before { display: none; }
.step .dot { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); display: grid; place-items: center; position: relative; z-index: 1; color: var(--ink-3); }
.step span { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.3; }
.step.done .dot { background: var(--mask); border-color: var(--mask); color: #fff; }
.step.done::before, .step.cur::before { background: var(--mask); }
.step.cur .dot { background: var(--gold); border-color: var(--gold); color: #2E2103; box-shadow: 0 0 0 4px var(--gold-soft); }
.step.cur span { color: var(--ink); }
.step:hover:not(.cur) .dot { border-color: var(--mask); }
.step:disabled { cursor: default; }

/* detail blocks */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--ink-3); font-size: 13px; }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.big-no { display: flex; align-items: center; gap: 14px; }
.big-no .stub { background: var(--board); color: var(--gold-2); border-radius: 12px; padding: 8px 16px; text-align: center; background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.07) 1px, transparent 0); background-size: 10px 10px; }
.big-no .stub span { display: block; font-size: 11px; color: #9FC0B2; }
.big-no .stub b { font-size: 28px; line-height: 1.1; }
.sum-lines { display: flex; flex-direction: column; gap: 8px; }
.sum-lines > div { display: flex; justify-content: space-between; gap: 10px; }
.sum-lines > div.total { border-top: 1px dashed var(--line-2); padding-top: 9px; font-weight: 700; font-size: 16px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 22px 14px 0; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; right: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.timeline li::after { content: ''; position: absolute; right: 9px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.st::before { background: var(--mask); }
.timeline .when { color: var(--ink-3); font-size: 12px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r-md); font-size: 13.5px; }
.alert.warn { background: var(--amber-soft); color: #6E4A08; }
.alert.bad { background: var(--red-soft); color: #7D2416; }
.alert.info { background: var(--blue-soft); color: #1B4675; }
.alert.ok { background: var(--green-soft); color: #145A3B; }

/* pattern lock */
.pattern { color: var(--mask); }
.pattern .dot { fill: var(--line-2); }
.pattern .on .dot { fill: var(--mask); }
.pattern .pnum { font-size: 10px; fill: var(--ink-3); font-weight: 700; }

/* chart */
.chart svg { display: block; direction: ltr; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .axis { fill: var(--ink-3); font-size: 11px; font-family: inherit; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; }

/* POS */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 16px; align-items: start; }
.pos .cart { position: sticky; top: 76px; display: flex; flex-direction: column; max-height: calc(100vh - 180px); }
.cart-lines { overflow-y: auto; flex: 1; min-height: 96px; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.cart-line .nm { font-weight: 600; font-size: 13.5px; }
.cart-line .ctrl { display: flex; align-items: center; gap: 6px; grid-column: 1 / -1; }
.qty-step { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.qty-step button { width: 30px; height: 30px; border: 0; background: var(--surface-2); cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }
.qty-step input { width: 46px; height: 30px; border: 0; border-radius: 0; text-align: center; padding: 0; }
.cart-total { padding: 14px 16px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.cart-total .grand { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; font-weight: 600; }
.cart-total .grand b { font-size: 28px; letter-spacing: -.5px; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 10px; }
.product { text-align: right; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; gap: 6px; min-height: 104px; }
.product:hover { border-color: var(--mask); box-shadow: var(--shadow); }
.product b { font-size: 13.5px; line-height: 1.4; }
.product .pr { margin-top: auto; display: flex; justify-content: space-between; align-items: center; }
.product .pr .money { font-size: 15px; color: var(--mask-ink); }
.product.out { opacity: .55; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(8, 30, 22, .42); display: grid; place-items: center; padding: 24px; z-index: 100; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; box-shadow: var(--shadow-lg); max-height: calc(100vh - 48px); display: flex; flex-direction: column; animation: pop .18s cubic-bezier(.2,.9,.3,1.2); }
.modal-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.modal-head > div { flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-start; flex-direction: row-reverse; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* toasts */
.toasts { position: fixed; bottom: 22px; left: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { display: flex; align-items: center; gap: 9px; background: var(--board); color: #fff; padding: 11px 16px; border-radius: 11px; box-shadow: var(--shadow-lg); font-weight: 500; max-width: 420px; animation: pop .2s ease; }
.toast.ok .ic { color: var(--gold-2); }
.toast.error { background: #7A2214; }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-art {
  background: var(--board); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.07) 1px, transparent 0); background-size: 22px 22px;
}
.login-art .mark { width: 92px; height: 92px; border-radius: 24px; box-shadow: 0 20px 50px -10px rgba(0,0,0,.5); }
.login-art h1 { font-size: 46px; margin-top: 26px; letter-spacing: -.5px; color: #fff; }
.login-art p { color: #A9C8BA; font-size: 17px; margin-top: 8px; max-width: 420px; }
.login-art .traces { position: absolute; left: -40px; bottom: -40px; width: 460px; opacity: .22; }
.login-art .foot { color: #7FA392; font-size: 13px; }
.login-form { display: grid; place-items: center; padding: 40px; }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 24px; margin-bottom: 6px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: #E6EBE7; border-radius: 13px; padding: 4px; gap: 4px; margin-bottom: 26px; }
.auth-tabs button { display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: transparent; font: inherit; font-size: 14.5px; font-weight: 700; color: var(--ink-2); padding: 11px 10px; border-radius: 10px; cursor: pointer; }
.auth-tabs button:hover { color: var(--ink); }
.auth-tabs button.on { background: var(--surface); color: var(--board); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.auth-tabs button:focus-visible { outline: none; box-shadow: var(--focus); }
.auth-empty { text-align: center; padding: 18px 0 6px; }
.auth-empty .btn { width: 100%; justify-content: center; }
.auth-approve { background: var(--gold-soft); border: 1px solid #F0DCA4; border-radius: var(--r-md); padding: 12px 14px 4px; }
.auth-approve label { display: inline-flex; align-items: center; gap: 6px; }
html.native .auth-tabs button { cursor: default; }
.users { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin: 22px 0; }
.user-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 16px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; font: inherit; font-weight: 600; color: var(--ink); }
.user-btn:hover { border-color: var(--mask); }
.user-btn .avatar { width: 46px; height: 46px; font-size: 18px; }
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 22px 0; }
.pin-dots i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line-2); }
.pin-dots i.on { background: var(--board); border-color: var(--board); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; direction: ltr; }
.pinpad button { height: 58px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 22px; font-weight: 600; cursor: pointer; color: var(--ink); }
.pinpad button:hover { background: var(--surface-2); }
.pinpad button.fn { font-size: 14px; color: var(--ink-3); }

/* misc */
.section-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 4px 0 10px; display: flex; align-items: center; gap: 8px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.progress { height: 8px; background: #E6EBE7; border-radius: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--mask); border-radius: 8px; transition: width .3s; }
.sticky-bar { position: sticky; bottom: 0; background: rgba(242,244,241,.95); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: 12px 0; margin-top: 18px; display: flex; gap: 8px; align-items: center; z-index: 20; }
.form-sec { padding: 18px; }
.form-sec + .form-sec { border-top: 1px solid var(--line); }
.form-sec h4 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; }
.form-sec h4 .ic { color: var(--mask); }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; user-select: none; }
.toggle input { display: none; }
.toggle .sw { width: 36px; height: 21px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.toggle .sw::after { content: ''; position: absolute; top: 3px; right: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + .sw { background: var(--mask); }
.toggle input:checked + .sw::after { transform: translateX(-15px); }
.menu { position: relative; }
.menu-list { position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; z-index: 70; }
.menu-list button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 10px; border: 0; background: none; font: inherit; color: var(--ink); border-radius: 8px; cursor: pointer; text-align: right; }
.menu-list button:hover { background: var(--surface-2); }
.menu-list button.danger { color: var(--red); }
.balance-hero { display: flex; align-items: baseline; gap: 8px; }
.balance-hero b { font-size: 30px; letter-spacing: -.5px; }
.acc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.acc { padding: 16px 18px; }
.acc span { color: var(--ink-3); font-size: 13px; display: flex; align-items: center; gap: 7px; }
.acc b { display: block; font-size: 24px; margin-top: 4px; letter-spacing: -.3px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.loading { display: grid; place-items: center; min-height: 50vh; color: var(--ink-3); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--mask); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.kbd-hint { font-size: 11.5px; color: var(--ink-3); display: inline-flex; gap: 4px; align-items: center; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink-3); padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--gold); }
.tabs button:hover { color: var(--ink); }
.note-box { background: var(--gold-soft); border: 1px solid #F0DCA4; border-radius: var(--r-md); padding: 10px 12px; font-size: 13px; color: #5E4507; }

@media (max-width: 1180px) {
  .cols.main-side { grid-template-columns: minmax(0, 1fr); }
  .strip .st { min-width: 118px; padding: 12px 14px; }
  .strip .st b { font-size: 19px; }
  .pos { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 860px) {
  .pos { grid-template-columns: 1fr; }
  .pos .cart { position: static; max-height: none; }
}
@media (max-width: 900px) {
  :root { --side: 74px; }
  .side .brand div, .nav a span.t, .nav .group, .me div, .nav a .badge { display: none; }
  .nav a { justify-content: center; }
  .page { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols.halves { grid-template-columns: minmax(0, 1fr); }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
@media (max-width: 600px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  .topbar .btn span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.after-actions { display: grid; gap: 10px; }
.after-actions .btn { justify-content: flex-start; height: 52px; }

/* ---------- desktop app window (html.native is set by the app; native-darwin = Mac, native-win32 = Windows) ---------- */
html.native body { -webkit-user-select: none; user-select: none; }
html.native input, html.native textarea, html.native td, html.native dd, html.native .pre, html.native .cell-title,
html.native .tk-problem, html.native .money, html.native .note-box { -webkit-user-select: text; user-select: text; }
html.native-darwin .topbar { -webkit-app-region: drag; padding-left: 96px; }
html.native-darwin .topbar > * { -webkit-app-region: no-drag; }
html.native-darwin .topbar > .grow { -webkit-app-region: drag; }
html.native-darwin .side .brand { -webkit-app-region: drag; }
html.native-darwin .modal-back, html.native-darwin .dropdown, html.native-darwin .menu-list, html.native-darwin .toasts { -webkit-app-region: no-drag; }
html.native-darwin .login::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: 40px; -webkit-app-region: drag; z-index: 5; }
html.native .btn, html.native .nav a, html.native .seg button, html.native .chip-btn, html.native .tabs button, html.native .dd-item,
html.native .ticket, html.native .table tbody tr.click, html.native .step, html.native .product, html.native .icon-btn, html.native .link,
html.native .user-btn, html.native .pinpad button, html.native .menu-list button, html.native .toggle, html.native label { cursor: default; }

/* ---------- 2.2: installments, debts, suppliers ---------- */
.mb-s { margin-bottom: 8px; }
.row-actions { white-space: nowrap; text-align: left; }
.row-actions > * { vertical-align: middle; }
.row-actions .btn + .icon-btn, .row-actions .icon-btn + .icon-btn { margin-inline-start: 2px; }
.icon-btn.wa-ic { color: #1F9D55; }
.icon-btn.wa-ic:hover { background: #E6F6EC; }
.tabs button .cnt { font-size: 11px; background: var(--slate-soft); color: var(--ink-2); border-radius: 99px; padding: 0 7px; margin-inline-start: 4px; }
.seg button .cnt.red { background: var(--red); color: #fff; border-radius: 99px; padding: 0 6px; font-weight: 700; }
.tag-mini.spec { display: inline-block; background: var(--mask-soft); color: var(--mask-ink); font-weight: 600; margin: 1px 0 1px 4px; padding: 1px 8px; font-size: 11.5px; }
.input-suffix.big-money input { font-size: 22px; font-weight: 700; height: 50px; letter-spacing: -.3px; }
.collect-done { text-align: center; }
.collect-done .cd-amt { background: var(--board); color: #fff; border-radius: 14px; padding: 16px; margin-bottom: 12px; background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.07) 1px, transparent 0); background-size: 10px 10px; }
.collect-done .cd-amt span { display: block; color: #A9C8BA; font-size: 13px; }
.collect-done .cd-amt b { font-size: 30px; color: var(--gold-2); letter-spacing: -.5px; }
.collect-done .sum-lines, .collect-done .list-plain { text-align: right; }
.open-items { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.open-items .oi-head { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.open-items .oi { display: flex; width: 100%; gap: 10px; align-items: center; justify-content: space-between; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); font: inherit; text-align: right; cursor: pointer; }
.open-items .oi:last-child { border-bottom: 0; }
.open-items .oi:hover { background: var(--gold-soft); }
.open-items .oi.on { background: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold); }
.open-items .oi-t, .open-items .oi-m { display: flex; flex-direction: column; min-width: 0; }
.open-items .oi-m { align-items: flex-end; text-align: left; flex: none; }
.open-items small { color: var(--ink-3); font-size: 11.5px; }
.open-items .oi-m b { color: var(--red); }
.aging .panel-body { padding: 14px 18px; }
.aging-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: #E6EBE7; gap: 2px; }
.aging-bar i { display: block; height: 100%; }
.a1 { background: #2E9C6A; } .a2 { background: #E2AE36; } .a3 { background: #E07B39; } .a4 { background: var(--red); }
.aging-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.aging-legend span { display: inline-flex; align-items: center; gap: 6px; }
.aging-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.debts-table td { vertical-align: top; }
.progress.lg { height: 10px; }
.inst-table tr.late td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.table.sched tr.st-late td { background: #FFF7F5; }
.table.sched tr.st-paid td { color: var(--ink-2); }
.table.sched tr.st-due td, .table.sched tr.st-soon td { background: #FFFBEF; }
.table tr.voided td { color: var(--ink-3); text-decoration: line-through; }
.table tr.voided td .pill { text-decoration: none; }
.inst-form .side-sum { position: relative; }
.sticky-sum { position: sticky; top: 76px; }
.inst-lines { display: flex; flex-direction: column; gap: 8px; }
.inst-line { display: flex; gap: 12px; align-items: flex-end; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.inst-line .field label { margin-bottom: 2px; }
.legacy-box { padding: 12px; border: 1px dashed var(--line-2); border-radius: 12px; background: var(--gold-soft); }
.inst-monthly { display: flex; flex-direction: column !important; align-items: stretch !important; background: var(--mask-soft); border-radius: 12px; padding: 10px 12px !important; margin-top: 6px; text-align: center; }
.inst-monthly span { font-size: 12.5px; color: var(--mask-ink); font-weight: 600; }
.inst-monthly b { font-size: 26px; color: var(--board); letter-spacing: -.5px; }
.inst-monthly small { color: var(--ink-3); font-size: 12px; }
.sched-edit tfoot td { background: var(--surface-2); }
.kv-list > div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv-list > div:last-child { border-bottom: 0; }
.kv-list span { color: var(--ink-3); }
.inst-dev { padding: 8px 0; border-bottom: 1px solid var(--line); }
.inst-dev:last-child { border-bottom: 0; }
.strip a.st.link-st { color: inherit; text-decoration: none; }
.strip a.st.link-st:hover { background: var(--surface-2); }
.list-plain.alloc li { padding: 6px 0; }
.open-list { padding: 0 18px 6px; }
.open-list li { padding: 8px 0; }
.panel.danger-zone { border-color: #EBC6BE; background: linear-gradient(0deg, #FFFBFA, #FFFBFA); }
.panel.danger-zone b { color: var(--red); }
.suggest { position: relative; }
.suggest > input { width: 100%; }
.suggest .dropdown { max-height: 260px; }

/* ---------- 2.3: «على الموبايل» (settings) ---------- */
.pc-head { display: flex; gap: 14px; align-items: flex-start; }
.pc-head h3 { font-size: 17px; margin-bottom: 3px; }
.pc-ic { width: 50px; height: 50px; border-radius: 15px; background: var(--board); color: var(--gold-2); display: grid; place-items: center; flex: none; }
.pc-codes { display: flex; flex-wrap: wrap; gap: 14px; }
.pc-code { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 18px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); min-width: 230px; }
.pc-qr { width: 190px; height: 190px; padding: 12px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.pc-qr svg { width: 100%; height: 100%; display: block; }
.pc-code b { font-size: 15px; letter-spacing: .2px; }
.pc-steps { list-style: none; margin: 0; padding: 0; counter-reset: st; display: grid; gap: 12px; }
.pc-steps li { counter-increment: st; display: grid; grid-template-columns: 30px 1fr; gap: 0 12px; align-items: start; }
.pc-steps li::before { content: counter(st); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.pc-steps b { font-size: 14px; }
.pc-steps span { font-size: 12.5px; color: var(--ink-3); }

/* ---------- 2.4: login from the internet ---------- */
.remote-pw { display: flex; flex-direction: column; gap: 6px; text-align: right; max-width: 300px; margin: 14px auto 4px; padding: 12px; border-radius: 14px; background: var(--gold-soft); border: 1px solid #F0DCA4; }
.remote-pw label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--gold-ink); }
.remote-pw input { width: 100%; height: 46px; font-size: 18px; letter-spacing: 2px; }

/* ---------- 2.4: camera scanner (phones) ---------- */
.input-scan { display: flex; gap: 6px; align-items: center; }
.input-scan > input { flex: 1; min-width: 0; }
.input-scan .scan-btn { width: 42px; height: 42px; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-md); }
.scan-btn { color: var(--mask); }
.search-field .scan-btn { margin-inline-end: -6px; }
.search-field.big:has(.scan-btn) > .ic:first-child { display: none; }
.scanner { position: fixed; inset: 0; z-index: 300; background: #000; color: #fff; animation: fade .15s ease; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 14px 14px; background: linear-gradient(rgba(0,0,0,.65), transparent); }
.scan-top b { font-size: 16px; }
.scan-x { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(8px); }
.scan-frame { position: absolute; left: 50%; top: 44%; width: min(78vw, 340px); height: min(46vw, 200px); transform: translate(-50%, -50%); box-shadow: 0 0 0 100vmax rgba(0,0,0,.42); border-radius: 18px; }
.scan-frame i { position: absolute; width: 34px; height: 34px; border: 4px solid var(--gold); }
.scan-frame i:nth-child(1) { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 18px; }
.scan-frame i:nth-child(2) { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 18px; }
.scan-frame i:nth-child(3) { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 18px; }
.scan-frame i:nth-child(4) { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 18px; }
.scan-frame .scan-line { position: absolute; left: 10px; right: 10px; top: 50%; height: 2px; background: rgba(226,174,54,.85); box-shadow: 0 0 12px rgba(226,174,54,.9); animation: scanmove 1.6s ease-in-out infinite alternate; }
.scan-frame.hit i { border-color: #4ADE80; }
@keyframes scanmove { from { transform: translateY(-70px); } to { transform: translateY(70px); } }
.scan-hint { position: absolute; left: 16px; right: 16px; top: calc(44% + min(23vw, 100px) + 26px); text-align: center; font-size: 15px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.scan-hint.err { color: #FFB4A6; }
.scan-hint.ok { color: #86EFAC; direction: ltr; }
.scan-done { position: absolute; left: 20px; right: 20px; bottom: calc(24px + env(safe-area-inset-bottom)); height: 52px; border: 0; border-radius: 16px; background: var(--gold); color: #2E2103; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }

/* ---------- 2.3: phone layout (iPhone / Android, ≤ 700px) ---------- */
.tabbar, .msheet-back, .tb-logo, .login-mobile-brand { display: none; }
@media (max-width: 900px) {
  .login-mobile-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
  .login-mobile-brand img { width: 52px; height: 52px; border-radius: 15px; box-shadow: 0 8px 20px -8px rgba(13, 58, 43, .5); }
  .login-mobile-brand b { display: block; font-size: 19px; line-height: 1.2; color: var(--board); }
  .login-mobile-brand span { font-size: 12.5px; color: var(--ink-3); }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
@media (max-width: 700px) {
  :root { --tabbar: 64px; }
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 14.5px; -webkit-tap-highlight-color: transparent; }
  .app { display: block; }
  .side { display: none; }
  .main { min-height: 100dvh; padding-bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); }

  /* top bar: logo + search + new repair */
  .topbar { padding: calc(8px + env(safe-area-inset-top)) 12px 8px; gap: 8px; }
  .tb-logo { display: block; flex: none; }
  .tb-logo img { width: 36px; height: 36px; border-radius: 10px; display: block; }
  .tb-sell { display: none !important; }
  .topbar .btn.primary { width: 40px; height: 40px; padding: 0; border-radius: 12px; flex: none; }
  .topbar > .grow { display: none; }
  .gsearch { max-width: none; min-width: 0; }
  .search-field input { min-width: 0; width: 100%; }
  .gsearch kbd { display: none; }
  .gsearch .search-field { height: 40px; border-radius: 12px; }
  .gsearch .results { position: fixed; top: calc(60px + env(safe-area-inset-top)); left: 8px; right: 8px; max-height: calc(100dvh - 150px - env(safe-area-inset-top)); }

  /* bottom tab bar */
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 50px; position: relative;
    font: inherit; font-size: 11px; font-weight: 600; color: var(--ink-3); background: none; border: 0; padding: 0; cursor: pointer;
  }
  .tabbar .on { color: var(--mask-ink); }
  .tabbar .on .ic { stroke-width: 2.4; }
  .tabbar .sell .fab {
    width: 54px; height: 54px; border-radius: 18px; background: var(--board); color: var(--gold-2); display: grid; place-items: center;
    margin-top: -26px; border: 4px solid var(--paper); box-shadow: 0 10px 22px -8px rgba(13, 58, 43, .6);
  }
  .tabbar .sell.on .fab { background: var(--mask); color: #fff; }
  .bdg { position: absolute; font-style: normal; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; background: var(--gold); color: #3A2A04; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; line-height: 1; box-shadow: 0 0 0 2px #fff; }
  .bdg.red { background: #E5634D; color: #fff; }
  .bdg.dot { min-width: 9px; width: 9px; height: 9px; padding: 0; }
  .tabbar .bdg { top: 2px; inset-inline-start: calc(50% + 4px); }

  /* «المزيد» sheet (sits under the tab bar so the same button closes it) */
  .msheet-back { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(8, 30, 22, .45); animation: fade .15s ease; }
  .msheet {
    position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface); border-radius: 22px 22px 0 0;
    padding: 8px 14px calc(var(--tabbar) + 22px + env(safe-area-inset-bottom)); max-height: 92dvh; overflow-y: auto; animation: sheet .22s cubic-bezier(.2, .9, .3, 1);
  }
  .msheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 2px auto 12px; }
  .msheet-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; }
  .msheet-user b { display: block; line-height: 1.2; }
  .msheet-user .grow span { font-size: 12px; color: var(--ink-3); }
  .msheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .msheet-grid a { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 4px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-align: center; }
  .msheet-grid a .mi { position: relative; width: 44px; height: 44px; border-radius: 13px; background: var(--mask-soft); color: var(--mask-ink); display: grid; place-items: center; }
  .msheet-grid a .mi .bdg { top: -6px; inset-inline-start: 30px; }
  .msheet-grid a .t { font-size: 12px; font-weight: 600; line-height: 1.3; color: var(--ink); }
  .msheet-grid a.on { border-color: var(--mask); background: var(--mask-soft); }
  .msheet-grid a.on .mi { background: var(--mask); color: #fff; }

  /* pages */
  .page { padding: 14px 12px 24px; }
  .page-head { gap: 10px; margin-bottom: 14px; align-items: stretch; }
  .page-head > div:first-child { min-width: 0; flex: 1 1 100%; }
  h1 { font-size: 21px; }
  .page-head .sub { font-size: 13px; }
  .page-head .actions { margin-inline-start: 0; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .page-head .actions::-webkit-scrollbar { display: none; }
  .page-head .actions > * { flex: none; }
  .row.wrap > .search-field, .row.wrap > input, .row.wrap > select, .row.wrap > .picker { width: 100% !important; flex: 1 1 100%; }
  .row.wrap > .grow:empty { display: none; }
  .search-field[style*="width"] { width: 100% !important; }
  .seg { max-width: 100%; }
  .tabs { margin-left: -12px; margin-right: -12px; padding: 0 8px; }
  .panel { border-radius: 14px; }
  .panel-head { padding: 12px 14px; flex-wrap: wrap; }
  .panel-head .actions { flex-wrap: wrap; }
  .panel-body { padding: 14px; }
  .form-sec { padding: 14px; }
  .cols, .cols.halves, .cols.main-side { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: 104px minmax(0, 1fr); }
  .strip .st { min-width: 46%; padding: 11px 13px; }
  .strip .st b { font-size: 18px; }
  .tickets.two { grid-template-columns: minmax(0, 1fr); }
  .tk-stub { width: 72px; }
  .tk-no { font-size: 20px; }
  .board { grid-auto-columns: 86%; margin: 0 -12px; padding: 0 12px 10px; scroll-snap-type: x mandatory; }
  .board-col { scroll-snap-align: start; }
  .acc-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .acc { padding: 12px 14px; }
  .acc b { font-size: 19px; }
  .onboard { grid-template-columns: minmax(0, 1fr); }
  .sticky-bar { bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding: 10px 0; flex-wrap: wrap; }
  .sticky-sum { position: static; }
  .inst-line { flex-wrap: wrap; }
  .inst-line > * { flex: 1 1 140px; }
  .menu-list { max-width: calc(100vw - 24px); }
  .chart { overflow-x: auto; }

  /* touch-friendly controls; 16px stops iOS from zooming into inputs */
  input, select, textarea { font-size: 16px; height: 42px; }
  textarea { height: auto; }
  .search-field { height: 42px; }
  .search-field.big { height: 48px; }
  .btn { height: 40px; }
  .btn.sm { height: 34px; }
  .table input, .qty-step input { height: 36px; }
  .icon-btn { width: 38px; height: 38px; }
  .seg button { padding: 7px 12px; }
  .chip-btn { padding: 6px 13px; }
  .toggle .sw { width: 42px; height: 25px; }
  .toggle .sw::after { width: 19px; height: 19px; }
  .toggle input:checked + .sw::after { transform: translateX(-17px); }

  /* wide tables → cards (labels come from the column headers, see main.js) */
  .table-wrap { overflow: visible; }
  .table.t-cards thead { display: none; }
  .table.t-cards, .table.t-cards tbody, .table.t-cards tfoot { display: block; width: 100%; }
  .table.t-cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: relative; }
  .table.t-cards tbody tr:last-child { border-bottom: 0; }
  .table.t-cards tfoot tr { background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; }
  .table.t-cards td { display: block; padding: 0; border: 0; min-width: 0; text-align: right; background: none !important; overflow-wrap: anywhere; }
  .table.t-cards tfoot td { border: 0; }
  .table.t-cards td:first-child { grid-column: 1 / -1; font-size: 15px; }
  .table.t-cards td:not(:first-child)[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 500; color: var(--ink-3); line-height: 1.35; margin-bottom: 1px; }
  .table.t-cards td:first-child[data-label="#"]::before { content: '#'; color: var(--gold-ink); font-weight: 700; }
  .table.t-cards td[colspan] { grid-column: 1 / -1; }
  .table.t-cards td:empty { display: none; }
  .table.t-cards td.row-actions { grid-column: 1 / -1; text-align: right; white-space: normal; }
  .table.t-cards input, .table.t-cards select { width: 100%; }
  .table.t-cards tr.click:active { background: var(--surface-2); }
  .table:not(.t-cards) th, .table:not(.t-cards) td { padding: 9px 10px; }
  .table-wrap > .table:not(.t-cards) { min-width: 100%; }
  .inst-table tr.late td:first-child { box-shadow: none; }
  .inst-table.t-cards tr.late { box-shadow: inset 3px 0 0 var(--red); }

  /* POS: products in 2 columns, cart under them + a floating cart bar */
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pos { grid-template-columns: minmax(0, 1fr); }
  .pos > * { min-width: 0; }
  .pos .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 2px 12px; min-width: 0; flex: 1 1 auto; }
  .pos .chips::-webkit-scrollbar { display: none; }
  .pos .chips .chip-btn { flex: none; }
  .pos .row.wrap { flex-wrap: nowrap; }
  .btn kbd, .sub kbd { display: none; }
  .product { min-height: 96px; padding: 11px; }
  .pos .cart { position: static; max-height: none; scroll-margin-top: 70px; }
  .cart-line .ctrl { flex-wrap: wrap; }
  .pos-cartbar {
    position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar) + 14px + env(safe-area-inset-bottom)); z-index: 80;
    display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 52px; border-radius: 16px; border: 0;
    background: var(--board); color: #fff; font: inherit; font-weight: 600; box-shadow: 0 14px 30px -10px rgba(8, 35, 26, .55); cursor: pointer;
  }
  .pos-cartbar .n { background: var(--gold); color: #2E2103; border-radius: 99px; min-width: 24px; height: 24px; display: grid; place-items: center; font-size: 13px; padding: 0 7px; }
  .pos-cartbar b { margin-inline-start: auto; color: var(--gold-2); font-size: 17px; }

  /* dialogs slide up from the bottom */
  .modal-back { padding: 0; place-items: end stretch; }
  .modal { max-width: none !important; width: 100%; border-radius: 20px 20px 0 0; max-height: calc(100dvh - 18px - env(safe-area-inset-top)); animation: sheet .22s cubic-bezier(.2, .9, .3, 1); }
  .modal-head { padding: 14px 16px 10px; }
  .modal-body { padding: 14px 16px; -webkit-overflow-scrolling: touch; }
  .modal-foot { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal-foot .btn.primary { flex: 1 1 auto; height: 46px; }

  .toasts { left: 12px; right: 12px; top: calc(62px + env(safe-area-inset-top)); bottom: auto; align-items: center; }
  .toast { max-width: 100%; }
  .dropdown { max-height: 46dvh; }

  /* login */
  .login-form { padding: calc(20px + env(safe-area-inset-top)) 18px 24px; place-items: start center; }
  .login-card h2 { font-size: 22px; }
  .pinpad button { height: 62px; }
}
@media (max-width: 380px) {
  .msheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table.t-cards tr { grid-template-columns: minmax(0, 1fr); }
}
