/* Starway ERP v2 — stage 3 look: three themes chosen from the user menu (html[data-theme]).
   navy  = Navy & Gold (default): deep navy page, faint Starway logo watermark, white cards, gold accent
   slate = Clean Slate: warm off-white page with a fine geometric pattern, navy header, teal accent
   midnight = dark mode: charcoal/dark-navy surfaces, soft glows, electric-blue accent
   Father's colour meaning is kept in every theme: green posted/paid, red unpaid/not posted,
   blue customer, purple supplier, yellow remaining. */

/* ---------- theme 1: Navy & Gold (also the fallback) ---------- */
:root {
  --page: #171a48;
  --page-bg: linear-gradient(160deg, #14163f 0%, #1c1f52 45%, #272a63 100%);
  --page-ink: #f4f1e6; --page-muted: #b9bbd9; --page-link: #e3c77f;
  --watermark: url("/v2/logo.png"); --wm-opacity: .05; --wm-filter: none;
  --pattern: none;
  --hdr-bg: rgba(12,13,42,.92); --hdr-ink: #fff; --hdr-line: rgba(201,162,74,.55); --hdr-btn: rgba(255,255,255,.08); --hdr-btn-line: rgba(255,255,255,.18);
  --tabs-bg: rgba(12,13,42,.55); --tabs-line: #c9a24a; --tab-ink: #c9cbe6; --tab-hover-bg: rgba(255,255,255,.08); --tab-hover-ink: #fff;
  --tab-on-bg: #c9a24a; --tab-on-ink: #14163f;
  --card: #fff; --text: #1b1d3a; --muted: #6a6d8c; --line: #e7e4da; --soft: #f7f5ef; --hover: #faf6ea;
  --card-border: rgba(201,162,74,.18); --shadow: 0 10px 30px rgba(5,6,30,.28), 0 1px 3px rgba(5,6,30,.2);
  --input-bg: #fff; --input-ro: #f4f2ec;
  --brand: #272a63; --th-bg: #f4f0e4; --th-ink: #3a3420;
  --accent: #c9a24a; --accent-2: #b48d36; --accent-ink: #14163f; --accent-soft: #f7efd9; --accent-soft-ink: #6f5413; --focus: #c9a24a;
  --cust: #e1efff; --cust-t: #0b5394; --cust-cell: #f1f7ff;
  --sup: #eee9fc; --sup-t: #5a3fb0; --sup-cell: #f7f4fe;
  --rem: #fff3c4; --rem-t: #7d5f00; --rem-cell: #fffae6;
  --ok: #dcf3e3; --ok-t: #17703a;
  --bad: #fde2e1; --bad-t: #ae2424;
  --total-bg: #272a63; --total-ink: #f4d98b;
  --drop-bg: #fff; --backdrop: rgba(8,9,30,.6);
  --radius: 14px;
  color-scheme: light;
  font-family: -apple-system, "SF Pro Text", "Geeza Pro", Tahoma, "Segoe UI", system-ui, sans-serif;
}

/* ---------- theme 2: Clean Slate ---------- */
:root[data-theme="slate"] {
  --page: #f3f1ed;
  --page-bg: linear-gradient(180deg, #f6f4f0 0%, #efede8 100%);
  --pattern:
    repeating-linear-gradient(45deg, rgba(27,36,64,.035) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(-45deg, rgba(27,36,64,.035) 0 1px, transparent 1px 26px);
  --page-ink: #1b2440; --page-muted: #66708a; --page-link: #0f766e;
  --watermark: none;
  --hdr-bg: #1b2440; --hdr-ink: #fff; --hdr-line: #0f8a7e; --hdr-btn: rgba(255,255,255,.08); --hdr-btn-line: rgba(255,255,255,.2);
  --tabs-bg: #fff; --tabs-line: #d9d6cf; --tab-ink: #5b6480; --tab-hover-bg: #eef6f5; --tab-hover-ink: #0f766e;
  --tab-on-bg: #0f8a7e; --tab-on-ink: #fff;
  --card: #fff; --text: #1b2440; --muted: #68718a; --line: #e3e0d9; --soft: #f7f6f2; --hover: #f1f8f7;
  --card-border: #e3e0d9; --shadow: 0 1px 2px rgba(27,36,64,.06);
  --input-bg: #fff; --input-ro: #f5f4f0;
  --brand: #1b2440; --th-bg: #f3f2ee; --th-ink: #3b4560;
  --accent: #0f8a7e; --accent-2: #0b6f66; --accent-ink: #fff; --accent-soft: #e3f4f1; --accent-soft-ink: #0b5f57; --focus: #0f8a7e;
  --cust: #e2eefc; --cust-t: #0d4f8f; --cust-cell: #f2f7fd;
  --sup: #efeafb; --sup-t: #57409e; --sup-cell: #f7f5fd;
  --rem: #fdf1c7; --rem-t: #7a5b00; --rem-cell: #fffae8;
  --ok: #dcf2e3; --ok-t: #176b38;
  --bad: #fbe3e1; --bad-t: #a92727;
  --total-bg: #1b2440; --total-ink: #7fe0d4;
  --drop-bg: #fff; --backdrop: rgba(27,36,64,.45);
}

/* ---------- theme 3: Midnight ---------- */
:root[data-theme="midnight"] {
  --page: #0b0f1c;
  --page-bg:
    radial-gradient(900px 500px at 10% -10%, rgba(59,130,246,.18), transparent 60%),
    radial-gradient(800px 600px at 110% 20%, rgba(99,102,241,.14), transparent 60%),
    linear-gradient(180deg, #0b0f1c 0%, #0e1324 100%);
  --pattern: none;
  --page-ink: #e8ebf7; --page-muted: #96a0bf; --page-link: #7cb0ff;
  --watermark: url("/v2/logo.png"); --wm-opacity: .03;
  --hdr-bg: rgba(8,11,22,.9); --hdr-ink: #eef1fb; --hdr-line: rgba(79,140,255,.6); --hdr-btn: rgba(255,255,255,.06); --hdr-btn-line: rgba(255,255,255,.14);
  --tabs-bg: rgba(14,19,36,.85); --tabs-line: #263055; --tab-ink: #9aa4c4; --tab-hover-bg: rgba(79,140,255,.1); --tab-hover-ink: #dbe6ff;
  --tab-on-bg: #3b7bff; --tab-on-ink: #fff;
  --card: #151a2c; --text: #e6e9f5; --muted: #98a1bf; --line: #262d48; --soft: #1a2036; --hover: #1c2440;
  --card-border: #232a45; --shadow: 0 0 0 1px rgba(79,140,255,.04), 0 12px 32px rgba(0,0,0,.45);
  --input-bg: #0f1324; --input-ro: #141a2e;
  --brand: #dbe4ff; --th-bg: #1b2139; --th-ink: #b9c3e3;
  --accent: #3b7bff; --accent-2: #5a91ff; --accent-ink: #fff; --accent-soft: rgba(59,123,255,.16); --accent-soft-ink: #a9c6ff; --focus: #5a91ff;
  --cust: rgba(59,130,246,.18); --cust-t: #93c0ff; --cust-cell: rgba(59,130,246,.07);
  --sup: rgba(167,139,250,.18); --sup-t: #c8b8ff; --sup-cell: rgba(167,139,250,.07);
  --rem: rgba(250,204,21,.15); --rem-t: #fcd768; --rem-cell: rgba(250,204,21,.06);
  --ok: rgba(34,197,94,.16); --ok-t: #74e3a2;
  --bad: rgba(239,68,68,.18); --bad-t: #ff9d9d;
  --total-bg: #1f3a7a; --total-ink: #fff;
  --drop-bg: #171d31; --backdrop: rgba(0,0,0,.65);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; color: var(--text); font-size: 15px; }
html { background: var(--page); }
body { background: transparent; min-height: 100vh; position: relative; }
body::before { content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none; background: var(--pattern), var(--page-bg); }
body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--watermark) center 58% / min(78vw, 980px) auto no-repeat; opacity: var(--wm-opacity, 0); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--page-link); }
.card a, .tablewrap a, .drop a, dialog a { color: var(--accent-soft-ink); }
:root[data-theme="slate"] .card a, :root[data-theme="slate"] .tablewrap a { color: var(--accent-2); }

/* header */
.top { background: var(--hdr-bg); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--hdr-line); color: var(--hdr-ink); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 18px; position: sticky; top: 0; z-index: 5; }
.top img { height: 32px; max-width: 45vw; object-fit: contain; }
.top .brand { font-weight: 700; font-size: 15px; letter-spacing: .02em; opacity: .9; padding-inline-start: 10px; border-inline-start: 1px solid var(--hdr-btn-line); }
.top .grow { flex: 1; }
.top .who { opacity: .85; font-size: 13px; }
.top button { background: var(--hdr-btn); border: 1px solid var(--hdr-btn-line); color: var(--hdr-ink); border-radius: 10px; padding: 6px 12px; cursor: pointer; }
.top button:hover { background: rgba(255,255,255,.16); }
.bell { position: relative; }
.bell .count { position: absolute; top: -6px; inset-inline-end: -6px; background: #e0474c; color: #fff; border-radius: 9px; font-size: 11px; padding: 0 5px; min-width: 18px; text-align: center; }

.tabs { display: flex; gap: 4px; padding: 8px 14px 0; background: var(--tabs-bg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 2px solid var(--tabs-line); overflow-x: auto; scrollbar-width: thin; }
.tabs button { border: 0; background: transparent; padding: 10px 15px; border-radius: 10px 10px 0 0; cursor: pointer; white-space: nowrap; color: var(--tab-ink); font-weight: 600; }
.tabs button.on { background: var(--tab-on-bg); color: var(--tab-on-ink); }
.tabs button:hover:not(.on) { background: var(--tab-hover-bg); color: var(--tab-hover-ink); }

main { max-width: 1400px; margin: 0 auto; padding: 22px 18px 60px; }
h1 { font-size: 21px; margin: 4px 0 16px; color: var(--page-ink); letter-spacing: .01em; }
h3 { color: var(--brand); }
.crumbs { color: var(--page-muted); font-size: 13px; margin-bottom: 4px; }
.crumbs a { cursor: pointer; text-decoration: none; color: var(--page-link); }
.card h1, dialog h1 { color: var(--brand); }

/* icon tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 16px; }
.tile { background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 24px 12px 18px; text-align: center; cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; text-decoration: none; color: inherit; display: block; position: relative; overflow: hidden; }
.tile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); opacity: 0; transition: opacity .12s; }
.tile:hover { transform: translateY(-3px); border-color: var(--accent); }
.tile:hover::before { opacity: 1; }
.tile .ico { font-size: 30px; line-height: 1; margin: 0 auto 12px; width: 62px; height: 62px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); }
.tile .nm { font-weight: 700; color: var(--brand); }
.tile .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.tile.soon { opacity: .55; cursor: default; }
.tile.soon:hover { transform: none; border-color: var(--card-border); }
.tile.soon:hover::before { opacity: 0; }

/* cards & toolbar */
.card { background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 8px; margin-bottom: 14px; }
.toolbar .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.toolbar .pos { color: var(--muted); font-size: 13px; padding: 0 4px; }
.btn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 7px 12px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; text-decoration: none; }
.btn:hover:not(:disabled) { background: var(--hover); border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: var(--bad-t); }
.btn.ok { color: var(--ok-t); }

/* forms */
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea, .cellin { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--input-bg); color: var(--text); min-width: 0; }
.field input:focus, .field select:focus, .field textarea:focus, .cellin:focus, .search:focus { outline: 2px solid var(--focus); outline-offset: -1px; }
.field input[readonly], .field input:disabled, .field select:disabled, .field textarea:disabled, .cellin:disabled { background: var(--input-ro); color: var(--muted); }
.field textarea { min-height: 60px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); }
main > .hint, main > p.hint { color: var(--page-muted); }
.cellin { width: 96px; padding: 5px 8px; text-align: end; font-variant-numeric: tabular-nums; }

/* counters & totals */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat { border-radius: 12px; padding: 10px 12px; background: var(--soft); border: 1px solid transparent; }
.stat .k { font-size: 12px; font-weight: 600; opacity: .85; }
.stat .v { font-size: 19px; font-weight: 700; margin-top: 2px; direction: ltr; text-align: start; unicode-bidi: plaintext; font-variant-numeric: tabular-nums; }
.c-cust { background: var(--cust); color: var(--cust-t); }
.c-sup { background: var(--sup); color: var(--sup-t); }
.c-rem { background: var(--rem); color: var(--rem-t); }
.c-ok { background: var(--ok); color: var(--ok-t); }
.c-bad { background: var(--bad); color: var(--bad-t); }
.c-navy { background: var(--total-bg); color: var(--total-ink); }

/* tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--card-border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); margin-bottom: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { background: var(--th-bg); color: var(--th-ink); font-size: 12px; text-align: start; padding: 10px 8px; white-space: nowrap; position: sticky; top: 0; letter-spacing: .02em; }
td { padding: 8px; border-top: 1px solid var(--line); white-space: nowrap; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 160px; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--hover); }
tfoot td { font-weight: 700; background: var(--soft); font-variant-numeric: tabular-nums; }
td.cust { background: var(--cust-cell); color: var(--cust-t); } td.sup { background: var(--sup-cell); color: var(--sup-t); } td.rem { background: var(--rem-cell); color: var(--rem-t); }
tr.short td { background: var(--bad); }
td.shortv { color: var(--bad-t); font-weight: 700; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.ok { background: var(--ok); color: var(--ok-t); } .pill.bad { background: var(--bad); color: var(--bad-t); }
.pill.rem { background: var(--rem); color: var(--rem-t); }
.pill.navy { background: var(--accent-soft); color: var(--accent-soft-ink); }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.thumb.empty { background: var(--soft); }
.empty-msg { padding: 28px; text-align: center; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters h1 { margin: 0 0 0; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 12px; cursor: pointer; color: var(--text); }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.search, .filters select { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-width: 220px; flex: 1; max-width: 380px; background: var(--input-bg); color: var(--text); }
.filters select { min-width: 0; flex: 0 1 auto; }

.lockbar { background: var(--ok); color: var(--ok-t); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }
.warnbar { background: var(--rem); color: var(--rem-t); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }

/* dialog */
dialog { border: 1px solid var(--card-border); border-radius: 18px; padding: 0; width: min(760px, 96vw); max-height: 92vh; box-shadow: 0 24px 70px rgba(0,0,0,.35); background: var(--card); color: var(--text); }
dialog::backdrop { background: var(--backdrop); }
.dlg-head { background: var(--hdr-bg); color: var(--hdr-ink); padding: 13px 16px; font-weight: 700; border-bottom: 2px solid var(--accent); }
.dlg-body { padding: 16px; overflow: auto; max-height: calc(92vh - 120px); }
.dlg-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dlg-foot .grow { flex: 1; }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.photo-box { border: 1px dashed var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.photo-box img { max-width: 100%; max-height: 160px; border-radius: 8px; display: block; margin: 6px auto; }
.gallery { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.gallery figure { margin: 0; position: relative; }
.gallery img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.gallery button { position: absolute; top: 4px; inset-inline-end: 4px; border: 0; border-radius: 8px; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; padding: 2px 7px; }

/* login */
.login { max-width: 390px; margin: 10vh auto; background: var(--card); border-radius: 22px; padding: 30px; border: 1px solid var(--card-border); box-shadow: var(--shadow); }
.login img { height: 74px; max-width: 100%; object-fit: contain; display: block; margin: 0 auto 12px; background: #14163f; border-radius: 14px; padding: 12px 18px; }
.login h1 { text-align: center; color: var(--brand); }
.login .field { margin-bottom: 12px; }
.login .btn { width: 100%; justify-content: center; padding: 10px; }
.login .lang { text-align: center; margin-top: 14px; }
.login .lang .btn { width: auto; }
.err { color: var(--bad-t); min-height: 20px; font-size: 13px; margin-bottom: 8px; }

#toast { position: fixed; bottom: 18px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--total-bg); color: #fff; padding: 10px 18px; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: 90vw; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
[dir="rtl"] #toast { transform: translateX(50%); }
#toast.show { opacity: 1; }
#toast.error { background: #b42323; }

/* global search, bell dropdown, user menu */
.gsearch { position: relative; flex: 1 1 260px; max-width: 460px; }
.gsearch input { width: 100%; border: 1px solid var(--hdr-btn-line); background: var(--hdr-btn); color: var(--hdr-ink); border-radius: 10px; padding: 7px 12px; }
.gsearch input::placeholder { color: rgba(255,255,255,.62); }
.gsearch input:focus { outline: 2px solid var(--accent); background: rgba(255,255,255,.14); }
.drop { position: absolute; top: calc(100% + 6px); inset-inline-start: 0; width: min(520px, 92vw); max-height: 70vh; overflow: auto; background: var(--drop-bg); color: var(--text); border: 1px solid var(--card-border); border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.35); z-index: 30; padding: 6px 0; }
.drop.end { inset-inline-start: auto; inset-inline-end: 0; }
.drop h4 { margin: 10px 14px 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.drop a { display: flex; gap: 8px; align-items: baseline; padding: 7px 14px; text-decoration: none; color: inherit; cursor: pointer; }
.drop a:hover, .drop a:focus { background: var(--hover); outline: none; }
.drop a b { color: var(--brand); white-space: nowrap; }
.drop .sub { color: var(--muted); font-size: 12px; }
.drop .none { padding: 12px 14px; color: var(--muted); }
.drop .cfg { display: flex; gap: 6px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.drop .cfg input { width: 64px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; background: var(--input-bg); color: var(--text); }
.bellwrap, .userwrap { position: relative; }
.bell .count.zero { background: #6b6f8f; }
.usermenu { width: 280px; }
.usermenu .who2 { padding: 8px 14px 10px; border-bottom: 1px solid var(--line); }
.usermenu .who2 b { display: block; color: var(--brand); }
.usermenu .who2 span { font-size: 12px; color: var(--muted); }
.themes { display: grid; gap: 6px; padding: 4px 10px 8px; }
.themes button { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 7px 10px; cursor: pointer; text-align: start; }
.themes button:hover { border-color: var(--accent); }
.themes button.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 700; }
.sw { width: 34px; height: 22px; border-radius: 6px; flex: none; border: 1px solid rgba(0,0,0,.15); display: inline-block; position: relative; overflow: hidden; }
.sw::after { content: ""; position: absolute; inset-inline-end: 4px; top: 6px; width: 9px; height: 9px; border-radius: 50%; }
.sw-navy { background: linear-gradient(135deg, #14163f, #272a63); } .sw-navy::after { background: #c9a24a; }
.sw-slate { background: #f3f1ed; } .sw-slate::after { background: #0f8a7e; }
.sw-midnight { background: linear-gradient(135deg, #0b0f1c, #1a2036); } .sw-midnight::after { background: #3b7bff; box-shadow: 0 0 6px #3b7bff; }
.menu-item { display: block; width: calc(100% - 20px); margin: 4px 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 8px 10px; cursor: pointer; text-align: start; }
.menu-item:hover { border-color: var(--accent); }
.top .drop button, .top .usermenu button { color: var(--text); background: var(--card); border-color: var(--line); }
.top .drop button:hover { background: var(--hover); }

.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.actions .btn { font-size: 13px; }
.btn.in { color: var(--ok-t); } .btn.out { color: var(--bad-t); }
tr.conv td { font-weight: 700; background: var(--rem-cell); border-top: 2px solid var(--rem-t); }
td.pos { color: var(--bad-t); } td.neg { color: var(--ok-t); }
.minihead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 20px 0 10px; }
.minihead h2 { font-size: 17px; margin: 0; color: var(--page-ink); }
.card .minihead h2, dialog .minihead h2 { color: var(--brand); }
.card .minihead { margin-top: 4px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.kv div { min-width: 0; } .kv .k { font-size: 12px; color: var(--muted); font-weight: 600; } .kv .v { white-space: pre-wrap; overflow-wrap: anywhere; }
.printhead { display: none; }
.check { display: flex; gap: 8px; align-items: center; }
.field .check { min-height: 38px; }
.alert-list a { display: block; padding: 10px 12px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.alert-list a:hover { background: var(--hover); }
.placeholder { color: var(--muted); font-style: italic; }
.drop.static { position: static; width: auto; max-height: none; box-shadow: var(--shadow); }
.profit-pos { color: var(--ok-t); } .profit-neg { color: var(--bad-t); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ltr { direction: ltr; unicode-bidi: plaintext; }

@media (max-width: 800px) {
  .gsearch { order: 10; flex-basis: 100%; max-width: none; }
  .grid2, .split { grid-template-columns: 1fr; }
  .top .who { display: none; }
  .top .brand { display: none; }
  .top img { height: 26px; }
  .top { padding: 8px 12px; }
  .top button { padding: 5px 9px; font-size: 13px; }
  .search { min-width: 0; max-width: none; }
  .fields { grid-template-columns: 1fr; }
  main { padding: 14px 12px 60px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile { padding: 18px 8px 14px; }
  .photos { grid-template-columns: 1fr; }
  body::after { background-size: 92vw auto; }
  .top .drop { position: fixed; top: calc(100% + 4px); left: 8px; right: 8px; inset-inline: 8px; width: auto; max-height: 75vh; }
}
@media print {
  .top, .tabs, .toolbar, .filters, .actions, .noprint, #toast { display: none !important; }
  html, body { background: #fff; color: #000; } body::before, body::after { display: none; }
  h1, .minihead h2 { color: #111; }
  .printhead { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
  .printhead img { height: 46px; background: #272a63; border-radius: 8px; padding: 6px 10px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .card, .tablewrap { box-shadow: none; border: 0; }
}
.cellin.wide-in { width: 220px; text-align: start; }
select.cellin { width: auto; text-align: start; }
input[type="date"].cellin { width: 150px; text-align: start; }
.top .themes button.on { border-color: var(--accent); }

/* ---------- stage 4: reports charts, period bar, users, settlement ---------- */
.filters.period { gap: 10px; }
label.inl { display: inline-flex; align-items: center; gap: 6px; color: var(--page-ink); font-size: 13px; }
label.inl input { width: auto; color: var(--text); background: var(--input-bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.chart h3 { margin: 0 0 10px; font-size: 14px; color: var(--brand); }
.barrow { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; align-items: center; gap: 8px; margin: 5px 0; font-size: 13px; }
.barrow .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow .track { background: var(--soft); border-radius: 6px; height: 14px; overflow: hidden; display: block; }
.barrow .fill { display: block; height: 100%; background: var(--accent); border-radius: 6px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.barrow .fill.neg { background: var(--bad-t); }
.barrow .fill.cust { background: var(--cust-t); } .barrow .fill.sup { background: var(--sup-t); }
.barrow .fill.b0 { background: var(--ok-t); } .barrow .fill.b1 { background: var(--accent); } .barrow .fill.b2 { background: var(--rem-t); } .barrow .fill.b3 { background: var(--bad-t); }
.barrow .val { direction: ltr; unicode-bidi: plaintext; font-variant-numeric: tabular-nums; font-weight: 600; min-width: 70px; text-align: end; }
.chart.cols .colrow { display: flex; align-items: flex-end; gap: 8px; height: 190px; overflow-x: auto; padding-bottom: 2px; }
.chart.cols .col { flex: 1 0 44px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.chart.cols .ctrack { flex: 1; width: 70%; display: flex; align-items: flex-end; background: var(--soft); border-radius: 6px 6px 0 0; }
.chart.cols .cfill { display: block; width: 100%; background: var(--accent); border-radius: 6px 6px 0 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.chart.cols .cfill.neg { background: var(--bad-t); }
.chart.cols .cval { font-size: 11px; font-weight: 700; direction: ltr; margin-bottom: 3px; }
.chart.cols .clbl { font-size: 11px; color: var(--muted); margin-top: 4px; direction: ltr; }
.grid2.charts { align-items: start; }
td.strong { font-weight: 700; }
td.late { color: var(--bad-t); font-weight: 600; }
tr.conv td { background: var(--total-bg); color: var(--total-ink); font-weight: 700; }
.card.narrow { max-width: 460px; }
.card.secret { border: 2px solid var(--accent); }
.card.secret code { display: inline-block; font-size: 22px; letter-spacing: .06em; padding: 8px 14px; margin: 8px 0; background: var(--soft); border-radius: 10px; user-select: all; }
.warnbar.nag a { color: inherit; font-weight: 700; }
@media (max-width: 800px) { .barrow { grid-template-columns: 38% 1fr auto; } label.inl { flex-wrap: wrap; } }
@media print { .card.secret { display: none; } .chart { break-inside: avoid; } tr.conv td { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---------- inquiries & sourcing ---------- */
.pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0; }
.card.warn { border-inline-start: 4px solid var(--rem); }
.flist { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.flist li { overflow-wrap: anywhere; }
.flist a { margin-inline-end: 6px; }
.check.on { background: var(--hover); border-radius: 8px; }
.choice-opts .check { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; margin: 4px 0; flex-wrap: wrap; }
.minihead .thumb { flex: none; }
.warnbar .btn { margin-inline-start: 6px; }

/* order record screen (father-style search + navigator) */
.rectool .grow { flex: 1; }
.rectool kbd { font: 600 11px/1 ui-monospace, Menlo, monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 2px 4px; margin-inline-start: 2px; }
.recnav { display: inline-flex; align-items: center; gap: 4px; }
.recnav .navb { min-width: 34px; justify-content: center; padding-inline: 6px; }
.recnav .pos { font-weight: 700; color: var(--text); min-width: 62px; text-align: center; font-variant-numeric: tabular-nums; }
.recmenu { position: relative; display: inline-block; }
.recsearch { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.recsearch .search.recq { max-width: 560px; font-size: 16px; padding: 10px 14px; border: 2px solid var(--accent); }
.recpick table tr { cursor: pointer; }
.recpick tr.cur td { background: var(--accent-soft); font-weight: 700; }
.recpick .minihead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
@media (max-width: 800px) {
  .rectool kbd { display: none; }
  .recsearch .search.recq { min-width: 0; flex: 1 1 100%; max-width: none; }
  .rectool .grow { display: none; }
}

/* ---------- father-replica record windows: order (father-07/10/04), supplier invoice (father-08), invoice movements (father-09) ---------- */
:root { --grid-empty: #c8c5bc; --yel-in: #fff9d6; --link-blue: #1d4ed8; }
:root[data-theme="slate"] { --grid-empty: #d5d2cb; --yel-in: #fff8d9; --link-blue: #1d4ed8; }
:root[data-theme="midnight"] { --grid-empty: #20263d; --yel-in: rgba(250,204,21,.12); --link-blue: #8ab4ff; }
main.winmain { max-width: none; padding: 14px 16px 40px; }
.win { background: var(--card); color: var(--text); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.win-title { display: flex; align-items: center; gap: 8px; padding: 7px 14px; background: var(--total-bg); color: var(--total-ink); font-weight: 700; font-size: 14px; }
.win-title img { width: 18px; height: 18px; object-fit: contain; }
.wtool { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px 8px; background: var(--soft); border-bottom: 1px solid var(--line); }
.wbtn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid transparent; background: transparent; color: var(--text); border-radius: 7px; padding: 6px 9px; cursor: pointer; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.wbtn:hover:not(:disabled), .wbtn:focus-visible { background: var(--hover); border-color: var(--line); outline: none; }
.wbtn:disabled { opacity: .38; cursor: default; }
.wbtn .ic { font-size: 15px; line-height: 1; }
.wbtn.add .ic { color: var(--accent-2); } .wbtn.danger .ic { color: var(--bad-t); } .wbtn.save .ic { color: var(--cust-t); } .wbtn.ok .ic { color: var(--ok-t); }
.wbtn .caret { font-size: 11px; color: var(--muted); }
.wbtn kbd { font: 700 11px/1 ui-monospace, Menlo, monospace; color: var(--muted); }
.wsep { width: 1px; height: 22px; background: var(--line); margin: 0 5px; }
.wtool .recnav .navb { min-width: 30px; justify-content: center; padding-inline: 5px; color: var(--cust-t); }
.wtool .recnav .pos { font-weight: 800; min-width: 64px; }
.mvtool .wbtn { border-inline-end: 1px solid var(--line); border-radius: 0; padding: 7px 12px; }
.chip { display: inline-flex; gap: 2px; align-items: center; background: var(--accent-soft); color: var(--accent-soft-ink); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12.5px; font-weight: 700; margin-inline-start: 4px; }
.chip button { border: 0; background: transparent; cursor: pointer; color: inherit; font-weight: 800; padding: 2px 6px; }
.win-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
fieldset.grp { border: 1px solid var(--line); border-radius: 10px; margin: 0; padding: 10px 14px 14px; min-width: 0; }
fieldset.grp > legend { padding: 0 6px; font-weight: 800; color: var(--brand); font-size: 14px; }
.grp-split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px 32px; align-items: start; }
.grp-split.inv { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.fcol { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.fcol.side { gap: 14px; }
.frow { display: grid; grid-template-columns: 136px minmax(0, 1fr); align-items: center; gap: 10px; min-width: 0; }
.frow > label { font-weight: 700; font-size: 13.5px; color: var(--text); }
.frow-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 18px; }
.fctl { display: flex; gap: 6px; align-items: center; min-width: 0; }
.fctl input, .fctl select, .fctl textarea, .gin { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--input-bg); color: var(--text); min-width: 0; width: 100%; font-size: 14px; font-weight: 600; }
.fctl textarea { min-height: 66px; resize: vertical; }
.fctl input:focus, .fctl select:focus, .fctl textarea:focus, .gin:focus { outline: 2px solid var(--focus); outline-offset: -1px; }
.fctl input[readonly], .fctl input:disabled, .fctl select:disabled, .fctl textarea:disabled { background: var(--input-ro); }
.fctl input.yel, .fctl input.yel[readonly] { background: var(--yel-in); font-weight: 800; color: var(--text); }
.fctl .short { max-width: 210px; } .fctl .mid { max-width: 420px; }
.mag { flex: none; width: 32px; height: 31px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); cursor: pointer; font-size: 14px; }
.mag:hover:not(:disabled) { border-color: var(--accent); }
.mag:disabled { opacity: .4; cursor: default; }
.box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--soft); }
.counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; text-align: center; }
.counters.vert { grid-template-columns: 1fr; max-width: 260px; }
.cnt .k { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.cnt .v { border: 1px solid var(--line); border-radius: 6px; padding: 6px; font-weight: 800; font-variant-numeric: tabular-nums; background: var(--card); }
.cnt .v.green { background: var(--ok); color: var(--ok-t); } .cnt .v.red { background: var(--bad); color: var(--bad-t); }
.commbox, .postbox { display: grid; gap: 10px; }
.commbox .frow, .postbox .frow { grid-template-columns: 158px minmax(0, 1fr); }
.chkrow .frow { grid-template-columns: auto minmax(0, 1fr) !important; }
.chkrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.chkrow .check { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.chkrow .check input { width: 17px; height: 17px; accent-color: var(--cust-t); }
.chkrow .frow { flex: 1 1 240px; }
.posticon { display: inline-grid; place-items: center; width: 30px; height: 36px; border: 2px solid; border-radius: 3px 11px 3px 3px; font-weight: 900; font-size: 16px; flex: none; }
.posticon.on { color: var(--ok-t); border-color: var(--ok-t); background: var(--ok); } .posticon.off { color: var(--bad-t); border-color: var(--bad-t); background: var(--bad); }
.gridwrap { background: var(--grid-empty); border: 1px solid var(--line); border-radius: 8px; overflow: auto; min-height: 330px; max-height: 62vh; }
.gridwrap.s { min-height: 300px; } .gridwrap.mini { min-height: 140px; } .gridwrap.inv { min-height: 300px; }
table.wgrid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.wgrid th { position: sticky; top: 0; z-index: 1; background: var(--th-bg); color: var(--th-ink); font-size: 12.5px; font-weight: 800; padding: 7px 8px; text-align: center; border-inline-start: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; letter-spacing: 0; }
table.wgrid td { background: var(--card); color: var(--text); padding: 5px 8px; border-top: 1px solid var(--line); border-inline-start: 1px solid var(--line); text-align: center; white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
table.wgrid td.cust { background: var(--cust); color: var(--cust-t); } table.wgrid td.sup { background: var(--sup); color: var(--sup-t); } table.wgrid td.rem { background: var(--rem); color: var(--rem-t); }
table.wgrid td.wrap { white-space: normal; min-width: 130px; }
table.wgrid tbody tr:hover td:not(.cust):not(.sup):not(.rem) { background: var(--hover); }
table.wgrid tfoot td { background: var(--soft); font-weight: 800; position: sticky; bottom: 0; }
table.wgrid a { color: var(--link-blue); text-decoration: underline; font-weight: 700; }
table.wgrid td.bcell { padding: 3px 6px; width: 1%; }
table.wgrid td.edit { padding: 2px 3px; }
table.wgrid td.star { color: var(--muted); width: 1%; padding: 0 6px; }
table.wgrid tr.newrow td { text-align: start; background: var(--card); }
table.wgrid tr.newrow td.muted { color: var(--muted); font-weight: 600; }
table.wgrid input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--cust-t); }
table.wgrid .thumb { width: 34px; height: 34px; margin: 0 auto; }
table.wgrid td.curcell { background: var(--accent-soft); color: var(--accent-soft-ink); }
.gbtn { border: 1px solid var(--line); background: var(--soft); color: var(--text); border-radius: 6px; padding: 3px 10px; cursor: pointer; font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.gbtn:hover, .gbtn:focus-visible { border-color: var(--accent); background: var(--hover); outline: none; }
.gin { padding: 4px 6px; border-radius: 4px; text-align: center; font-size: 13.5px; }
.gin.w-s { width: 70px; } .gin.w-m { width: 100px; } .gin.w-l { min-width: 220px; text-align: start; }
td.cust .gin { background: var(--cust-cell); } td.sup .gin { background: var(--sup-cell); }
.wtotals { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px 16px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--soft); }
.wtotals.three { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); }
.wtotals.one { grid-template-columns: max-content minmax(0, 360px); justify-content: start; }
.wtotals .k { font-weight: 800; font-size: 14px; }
.wtotals .v { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 0; max-width: 300px; width: 100%; justify-self: start; }
.wtotals .v.cust { background: var(--cust); color: var(--cust-t); } .wtotals .v.sup { background: var(--sup); color: var(--sup-t); } .wtotals .v.rem { background: var(--rem); color: var(--rem-t); }
.invsums { display: flex; flex-direction: column; gap: 8px; }
.mvhead { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 18px; }
.mvhead .frow { grid-template-columns: auto minmax(0, 1fr); }
.radios { display: flex; gap: 26px; padding: 2px 4px 10px; font-weight: 700; }
.radios label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.radios input { width: 17px; height: 17px; accent-color: var(--cust-t); }
dialog.pagedlg.wide { width: min(980px, 96vw); } dialog.pagedlg.xwide { width: min(1280px, 97vw); }
.dlg-search { display: flex; gap: 8px; align-items: center; }
.dlg-search .search { flex: 1; min-width: 0; }
.dlg-list { max-height: 58vh; overflow: auto; margin-top: 10px; }
.picklist { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.picklist button { text-align: start; border: 0; border-bottom: 1px solid var(--line); background: var(--card); padding: 9px 12px; cursor: pointer; color: var(--text); font-weight: 600; }
.picklist button:hover, .picklist button:focus-visible { background: var(--hover); outline: none; }
.picktbl tbody tr { cursor: pointer; }
.picktbl tr.cur td { background: var(--accent-soft); }
@media (max-width: 1000px) {
  .grp-split, .grp-split.inv { grid-template-columns: 1fr; }
  .mvhead { grid-template-columns: 1fr 1fr; }
  .wtotals.three { grid-template-columns: auto minmax(0, 1fr); }
}
@media (max-width: 700px) {
  main.winmain { padding: 8px 8px 30px; }
  .win-body { padding: 10px; }
  .frow-pair, .mvhead { grid-template-columns: 1fr; }
  .frow { grid-template-columns: 100px minmax(0, 1fr); }
  .wtotals { grid-template-columns: auto minmax(0, 1fr); }
  .wtool kbd { display: none; }
  .counters { gap: 8px; }
  .fctl .short, .fctl .mid { max-width: none; }
}
@media print {
  .wtool, .crumbs, .mag, .gbtn { display: none !important; }
  .win { box-shadow: none; border: 0; }
  .gridwrap { max-height: none; overflow: visible; min-height: 0; background: none; }
  table.wgrid td.cust, table.wgrid td.sup, table.wgrid td.rem, .wtotals .v { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.crumbs a, .crumbs span { unicode-bidi: isolate; }

/* ---------- goods receiving (25 Nov): invoice «الاستلام» box, warehouse checks, staff phone page /v2/m ---------- */
.counters.four { grid-template-columns: repeat(4, 1fr); }
table.wgrid td.late { background: var(--bad); color: var(--bad-t); }
.recvbox { display: flex; flex-direction: column; gap: 10px; }
.recvhead { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; }
.recvhead .chkrow .frow { flex: 0 1 320px; }
.recvtot { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13.5px; }
.recvtot b { font-variant-numeric: tabular-nums; }
table.wgrid.recv td .hint { font-weight: 600; font-size: 11px; }
table.wgrid td.diffc, table.cmp td.diffc { background: var(--bad); color: var(--bad-t); }
.pill.diff { cursor: help; }
.thumbs { display: flex; gap: 4px; align-items: center; }
table.cmp { width: 100%; border-collapse: collapse; }
table.cmp th, table.cmp td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: start; font-variant-numeric: tabular-nums; }
.gallery figcaption { text-align: center; margin-top: 2px; }
.staffcard code { display: block; font-size: 18px; padding: 10px 14px; background: var(--soft); border-radius: 10px; user-select: all; word-break: break-all; margin-bottom: 8px; }

body.m-mode { font-size: 16px; }
body.m-mode::after { opacity: 0; }
.m-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--hdr-bg); color: var(--hdr-ink); border-bottom: 2px solid var(--hdr-line); }
.m-top img { height: 30px; width: 30px; object-fit: contain; }
.m-ttl { flex: 1; min-width: 0; font-weight: 800; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-top button { min-width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--hdr-btn-line); background: var(--hdr-btn); color: var(--hdr-ink); font-size: 18px; font-weight: 800; cursor: pointer; }
.m-main { max-width: 640px; margin: 0 auto; padding: 12px 12px 90px; display: flex; flex-direction: column; gap: 12px; }
.m-nag { display: block; background: var(--rem); color: var(--rem-t); border-radius: 12px; padding: 12px; font-weight: 700; text-decoration: none; }
.m-full { color: var(--page-link); text-align: center; padding: 8px; }
.m-search { width: 100%; box-sizing: border-box; font-size: 17px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--input-bg); color: var(--text); }
.m-seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.m-seg button { border: 0; background: transparent; color: var(--text); padding: 12px 4px; font-size: 15px; font-weight: 700; cursor: pointer; min-height: 48px; }
.m-seg button.on { background: var(--accent); color: var(--accent-ink); }
.m-list { display: flex; flex-direction: column; gap: 10px; }
.m-list .empty-msg { color: var(--page-muted); text-align: center; padding: 24px; }
.m-card { display: block; background: var(--card); color: var(--text); border: 1px solid var(--card-border); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); text-decoration: none; }
.m-card h3 { margin: 0 0 8px; color: var(--brand); font-size: 16px; }
.m-inv { border-inline-start: 5px solid var(--accent); }
.m-inv.late { border-inline-start-color: var(--bad-t); }
.m-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m-row .grow { flex: 1; }
.m-mark { background: var(--total-bg); color: var(--total-ink); font-weight: 900; letter-spacing: .04em; border-radius: 10px; padding: 5px 12px; font-size: 17px; direction: ltr; }
.m-big { font-size: 21px; font-weight: 900; margin-top: 8px; direction: ltr; text-align: start; unicode-bidi: plaintext; }
.m-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.m-meta { margin-top: 8px; justify-content: space-between; font-size: 14px; }
.m-item.done { border-inline-start: 5px solid var(--ok-t); }
.m-itemno { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 2px 9px; }
.m-model { font-weight: 800; font-size: 17px; margin-top: 4px; }
.m-idph { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.m-idph figure { margin: 0; }
.m-idph img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--soft); border-radius: 12px; border: 1px solid var(--line); display: block; }
.m-idph figcaption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 2px; }
.m-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.m-nums div { background: var(--soft); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.m-nums span { font-size: 12px; color: var(--muted); }
.m-nums b { font-variant-numeric: tabular-nums; }
.m-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; box-sizing: border-box; min-height: 52px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--soft); color: var(--text); font-size: 17px; font-weight: 800; text-decoration: none; cursor: pointer; padding: 10px; }
.m-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.m-btn.big { min-height: 60px; font-size: 19px; }
.m-btn:disabled { opacity: .6; }
.m-btn.cam { background: var(--brand); border-color: var(--brand); color: #fff; min-height: 64px; font-size: 19px; }
.m-head .m-kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin-top: 10px; font-size: 15px; }
.m-head .m-kv span { color: var(--muted); }
.m-form { display: flex; flex-direction: column; gap: 14px; }
.m-shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.m-shots:empty { display: none; }
.m-shots figure { margin: 0; position: relative; }
.m-shots img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; display: block; }
.m-shots button { position: absolute; top: 4px; inset-inline-end: 4px; width: 32px; height: 32px; border-radius: 10px; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 15px; }
.m-fld { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.m-fld > span { font-size: 15px; }
.m-in { width: 100%; box-sizing: border-box; min-height: 52px; font-size: 20px; font-weight: 700; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--input-bg); color: var(--text); text-align: center; font-variant-numeric: tabular-nums; }
textarea.m-in { font-size: 16px; text-align: start; min-height: 64px; }
.m-in:focus { outline: 3px solid var(--focus); outline-offset: -1px; }
.m-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.m-calc { display: flex; justify-content: space-between; align-items: center; background: var(--accent-soft); color: var(--accent-soft-ink); border-radius: 12px; padding: 10px 14px; font-weight: 700; }
.m-calc b { font-size: 18px; font-variant-numeric: tabular-nums; direction: ltr; }
.m-chk { display: flex; align-items: center; gap: 12px; font-weight: 700; min-height: 48px; }
.m-chk input { width: 26px; height: 26px; accent-color: var(--bad-t); }
.m-prev { border-top: 1px solid var(--line); padding: 10px 0; }
.m-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.m-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
body.m-mode .card.narrow { max-width: none; }
@media print { .m-top { display: none; } }
.m-top button.out { font-size: 14px; padding: 0 10px; }
.m-grid3 { direction: ltr; }
.ckst { white-space: normal; min-width: 150px; } .ckst .pill { margin: 2px 0; }

/* ---------- 25 Nov: third language (Chinese, simplified) — clean CJK font stack, 3-way language switch ---------- */
:root:lang(zh) { font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", -apple-system, system-ui, sans-serif; }
[lang="zh-CN"] { font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", -apple-system, system-ui, sans-serif; }
[lang="ar"] .langsw [lang="zh-CN"], [lang="en"] .langsw [lang="zh-CN"] { font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif; }
.langsw { display: inline-flex; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.langsw button { border: 0; border-inline-end: 1px solid var(--line); background: transparent; color: var(--text); padding: 6px 12px; cursor: pointer; font-weight: 600; border-radius: 0; }
.langsw button:last-child { border-inline-end: 0; }
.langsw button:hover { background: rgba(127,127,127,.12); }
.langsw button.on { background: var(--accent); color: var(--accent-ink); }
.top .langsw.lsw-hdr { border-color: var(--hdr-btn-line); background: var(--hdr-btn); }
.top .langsw.lsw-hdr button { border: 0; border-inline-end: 1px solid var(--hdr-btn-line); border-radius: 0; background: transparent; color: var(--hdr-ink); padding: 6px 10px; min-width: 34px; }
.top .langsw.lsw-hdr button:last-child { border-inline-end: 0; }
.top .langsw.lsw-hdr button.on { background: rgba(255,255,255,.22); font-weight: 800; }
.top .langsw.lsw-menu { display: flex; margin: 4px 10px 8px; }
.top .langsw.lsw-menu button { flex: 1; border: 0; border-inline-end: 1px solid var(--line); border-radius: 0; background: var(--card); color: var(--text); padding: 7px 6px; }
.top .langsw.lsw-menu button:last-child { border-inline-end: 0; }
.top .langsw.lsw-menu button.on { background: var(--accent); color: var(--accent-ink); }
.login .langsw.lsw-login { margin: 0 auto; }
.login .langsw.lsw-login button { padding: 8px 14px; }
@media (max-width: 700px) { .top .langsw.lsw-hdr { display: none; } }
.m-top select.m-lang { height: 44px; border-radius: 12px; border: 1px solid var(--hdr-btn-line); background: var(--hdr-btn); color: var(--hdr-ink); font-size: 15px; font-weight: 700; padding: 0 8px; cursor: pointer; max-width: 30vw; }
.m-top select.m-lang option { color: #1b1d3a; background: #fff; }

/* ---------- supplier scorecard (25 Nov) ---------- */
.grade { display: inline-block; min-width: 2.2em; padding: 3px 10px; border-radius: 99px; font-weight: 800; font-size: 13px; text-align: center; white-space: nowrap; cursor: help; direction: ltr; unicode-bidi: isolate; }
.grade.big { font-size: 17px; padding: 4px 14px; vertical-align: middle; }
.grade.gA { background: var(--ok); color: var(--ok-t); }
.grade.gB { background: var(--cust); color: var(--cust-t); }
.grade.gC { background: var(--rem); color: var(--rem-t); }
.grade.gD { background: var(--bad); color: var(--bad-t); }
.grade.gnone { background: var(--soft); color: var(--muted); font-weight: 600; direction: inherit; }
td.sccell { min-width: 120px; }
td.sccell b { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: plaintext; }
td.sccell.s-ok b { color: var(--ok-t); } td.sccell.s-mid b { color: var(--rem-t); } td.sccell.s-bad b { color: var(--bad-t); }
td.sccell:hover { text-decoration: underline; }
td.bad-t { color: var(--bad-t); font-weight: 700; }
.schow summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.schow ul { margin: 8px 0 0; padding-inline-start: 20px; font-size: 13px; line-height: 1.6; color: var(--text); }
.card .schow { box-shadow: none; border: 1px dashed var(--line); margin: 12px 0 0; }
.scclick { color: var(--page-muted); margin: 0 0 8px; }
.scparts { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
a.stat.scpart { text-decoration: none; color: inherit; display: block; }
a.stat.scpart:hover { border-color: var(--accent); }
.stat.scpart .hint { margin-top: 2px; }
.stat.c-ok .hint, .stat.c-rem .hint, .stat.c-bad .hint { color: inherit; opacity: .8; }
.scwatch { border-inline-start: 4px solid var(--bad-t); }
.scwatch .tablewrap { box-shadow: none; margin-bottom: 0; }
.scwatch .pill { margin: 2px; }
.scsup .minihead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
h2.pagesub { color: var(--page-ink); margin: 18px 0 6px; }
@media print { .schow { display: none; } .scclick { display: none; } h2.pagesub { color: #000; } }
.filters label.scall { color: var(--page-ink); }
@media (max-width: 700px) { .scfilters .search { flex-basis: 100%; max-width: none; } .scfilters select { flex: 1 1 40%; } td.sccell { min-width: 104px; } }

/* ---------- price history (queue item 5, 25 Nov) ---------- */
.phfilters .search.phsearch { flex: 1 1 420px; max-width: 640px; font-size: 16px; }
.phinfo { color: var(--page-muted); margin: -4px 0 12px; }
.phgroup { margin-bottom: 16px; }
.phhead { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.phthumbs { display: flex; gap: 8px; flex: none; }
.phthumb { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 84px; text-decoration: none; color: var(--muted); font-size: 11px; text-align: center; }
.phthumb img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); }
.phthumb.empty::before { content: ""; display: block; width: 84px; height: 84px; border-radius: 10px; border: 1px dashed var(--line); background: var(--soft); }
.phtitle { flex: 1 1 220px; min-width: 0; }
.phtitle h2 { margin: 0 0 4px; font-size: 18px; color: var(--brand); overflow-wrap: anywhere; }
.phtitle .pill { margin-top: 6px; }
.phstats { flex: 1 1 380px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.phstats .stat .hint { overflow-wrap: anywhere; }
.phgroup h3 { margin: 14px 0 6px; font-size: 15px; color: var(--brand); }
.phquotes .tablewrap { box-shadow: none; margin: 12px 0 0; }
.phquotes td { vertical-align: top; }
.phquotes td.wrap { white-space: normal; min-width: 110px; max-width: 220px; overflow-wrap: anywhere; }
tr.phold td { background: var(--rem-cell); }
tr.phdecl td { opacity: .6; }
td.phact .btn { padding: 4px 10px; white-space: nowrap; }
.phcalc { margin-top: 12px; border: 1px dashed var(--accent); border-radius: 12px; padding: 10px 12px; background: var(--soft); }
.phcalc .minihead { margin: 0 0 8px; }
.phfields { margin-bottom: 8px; }
.phres { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.phnotes { grid-column: 1 / -1; line-height: 1.6; }
@media (max-width: 700px) {
  .phthumb, .phthumb img, .phthumb.empty::before { width: 64px; height: auto; }
  .phthumb img, .phthumb.empty::before { height: 64px; }
  .phstats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; flex-basis: 100%; }
  .phstats .stat { padding: 8px; } .phstats .stat .v { font-size: 16px; }
  /* quote rows become small cards: each cell shows its label */
  .phquotes .tablewrap { overflow: visible; background: transparent; }
  .phquotes table, .phquotes tbody, .phquotes tr, .phquotes td { display: block; width: 100%; }
  .phquotes thead { display: none; }
  .phquotes tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; padding: 6px 10px; background: var(--card); }
  .phquotes td { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; border: 0; padding: 3px 0; text-align: end; }
  .phquotes td.wrap { max-width: none; }
  .phquotes td[data-l]::before { content: attr(data-l); font-size: 12px; color: var(--muted); font-weight: 600; text-align: start; flex: none; }
  .phquotes td:empty, .phquotes td.empty-msg::before { display: none; }
  .phquotes td.phact { justify-content: flex-end; }
}
@media print { td.phact, .phcalc, .phfilters { display: none; } }
.phcustom[hidden] { display: none; }

/* ---------- Follow-up dashboard + profit per order / client (25 Nov, queue items 6-7) ---------- */
.db-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.db-top a { text-decoration: none; }
.db-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 14px; margin-bottom: 14px; }
.db-kpis > a { text-decoration: none; color: inherit; display: block; }
.db-kpi { background: var(--card); border: 1px solid var(--card-border); box-shadow: var(--shadow); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden; height: 100%; box-sizing: border-box; transition: transform .12s, border-color .12s; }
.db-kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--accent); }
.db-kpis > a:first-child .db-kpi { background: var(--total-bg); color: var(--total-ink); border-color: var(--accent); }
.db-kpis > a:first-child .db-kpi .k, .db-kpis > a:first-child .db-kpi .s, .db-kpis > a:first-child .db-kpi .n { color: inherit; opacity: .9; }
.db-kpi:hover { transform: translateY(-2px); border-color: var(--accent); }
.db-kpi .k { font-size: 13px; font-weight: 700; color: var(--muted); }
.db-kpi .v { font-size: 30px; font-weight: 800; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.db-kpi .s { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.db-kpi .n { font-size: 12px; margin-top: 6px; color: var(--muted); }
.db-kpi .n.warn { color: var(--rem-t); } .db-kpi .n.bad { color: var(--bad-t); }
.db-kpis > a:first-child .db-kpi .n.warn, .db-kpis > a:first-child .db-kpi .n.bad { color: var(--total-ink); }
.db-goal .db-ghead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.db-goal h2 { margin: 0; font-size: 17px; color: var(--brand); }
.db-goal > a { text-decoration: none; color: inherit; display: block; }
.db-gtrack { position: relative; height: 26px; border-radius: 13px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; }
.db-gfill { position: absolute; inset-block: 0; inset-inline-start: 0; display: block; min-width: 4px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 13px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.db-gpct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: var(--text); direction: ltr; }
.db-gfoot { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.db-gfoot .strong { font-weight: 800; color: var(--brand); }
.hint.bad-t, .warnbar.bad { color: var(--bad-t); }
.warnbar.bad { background: var(--bad); }
.db-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 14px; align-items: start; }
.db-card { margin-bottom: 0; min-width: 0; }
.db-chead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.db-chead h2 { margin: 0; font-size: 16px; color: var(--brand); }
.db-chead h2 a, .db-chead a { text-decoration: none; color: var(--brand); }
.db-more { font-size: 12px; font-weight: 700; color: var(--accent-soft-ink); background: var(--accent-soft); padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.db-big { font-size: 24px; font-weight: 800; color: var(--brand); display: flex; flex-wrap: wrap; gap: 4px 16px; font-variant-numeric: tabular-nums; }
.db-big.bad { color: var(--bad-t); }
.db-list { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.db-list > a { text-decoration: none; color: inherit; border-radius: 8px; }
.db-list > a:hover { background: var(--hover); }
.db-list .barrow { margin: 3px 4px; }
.db-row { display: flex; flex-direction: column; padding: 6px 8px; border-inline-start: 3px solid var(--line); margin: 2px 0; min-width: 0; }
.db-row b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-row .sub { font-size: 12px; color: var(--muted); }
.db-row.late { border-inline-start-color: var(--bad-t); }
.db-row .ltr { direction: ltr; unicode-bidi: plaintext; text-align: start; }
.db-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.db-pair > a { text-decoration: none; }
.db-money { display: flex; flex-direction: column; gap: 8px; }
.db-mrow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 8px; align-items: center; background: var(--soft); border-radius: 10px; padding: 8px 10px; }
.db-mrow .cur { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.db-mrow bdi { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-mrow span { display: flex; flex-direction: column; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 0; }
.db-mrow small { font-size: 11px; font-weight: 600; color: var(--muted); }
.db-mrow .in { color: var(--ok-t); } .db-mrow .out { color: var(--bad-t); } .db-mrow .net { color: var(--brand); } .db-mrow .net.neg { color: var(--bad-t); }
.db-pcard .db-pfoot { display: grid; grid-template-columns: minmax(0, 420px) 1fr; gap: 16px; margin-top: 12px; align-items: start; }
.db-pcard .db-pfoot .hint > div { margin-bottom: 4px; }
.db-ptab { width: 100%; border-collapse: collapse; font-size: 13px; }
.db-ptab td { padding: 4px 8px; border-bottom: 1px solid var(--line); }
.db-ptab td.num { text-align: end; font-variant-numeric: tabular-nums; }
.db-ptab tr.sum td { font-weight: 800; }
.db-ptab tr.sum.cust td { background: var(--cust-cell); color: var(--cust-t); }
.db-ptab tr.sum.sup td { background: var(--sup-cell); color: var(--sup-t); }
.db-ptab tr.sum.ok td { background: var(--ok); color: var(--ok-t); }
tr.muted-row td { opacity: .62; }
tr.muted-row td:last-child { opacity: 1; }
.db-fx { margin-top: 8px; }
.db-how p { margin: 6px 0; font-size: 13px; }
.db-how summary { cursor: pointer; font-weight: 700; color: var(--brand); }
dialog.narrowdlg { max-width: 420px; }
@media (max-width: 700px) {
  .db-kpi .v { font-size: 26px; }
  .db-pcard .db-pfoot { grid-template-columns: 1fr; }
  .db-mrow { font-size: 13px; }
}
@media print {
  .db-top .btn, .db-goal .btn, .db-more { display: none; }
  .db-kpi, .db-card, .db-goal { break-inside: avoid; box-shadow: none; }
  .db-how { display: block; }
}
/* ---------- container tracking + quote follow-up (25 Nov) ---------- */
.bad-t { color: var(--bad-t); } .ok-t { color: var(--ok-t); }
.tk-card .minihead .grow, .fu-card .minihead .grow { flex: 1; }
.tk-head { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tk-card a.btn { text-decoration: none; }
.tk-steps { list-style: none; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; padding: 0; margin: 6px 0 10px; counter-reset: none; }
.tk-steps li { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 12px; color: var(--muted); position: relative; }
.tk-steps li::before { content: ""; position: absolute; top: 13px; inset-inline-start: -50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.tk-steps li:first-child::before { display: none; }
.tk-steps li.done::before, .tk-steps li.on::before { background: var(--accent); }
.tk-steps .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--soft); border: 2px solid var(--line); color: var(--muted); position: relative; z-index: 1; }
.tk-steps li.done .dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tk-steps li.on .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.tk-steps li.on { color: var(--text); font-weight: 800; }
.tk-upd { grid-column: 1 / -1; border: 1px dashed var(--line); border-radius: 12px; padding: 8px 10px; margin: 4px 0 0; }
.tk-upd legend { font-weight: 800; color: var(--brand); padding: 0 6px; }
.btn.mini { padding: 3px 9px; font-size: 12px; min-height: 0; }
.fu-card .actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.fu-card .flist li { margin: 4px 0; }
.fu-card details summary { cursor: pointer; font-weight: 700; margin-top: 8px; }
@media (max-width: 640px) { .tk-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; } .tk-steps li::before { display: none; } }
@media print { .tk-upd, .fu-card .actions { display: none; } }
.grid2 > * { min-width: 0; }   /* tables scroll inside their card instead of widening the page (phone) */
.fu-card .minihead { justify-content: flex-start; }
/* product catalogue (queue item 10, 25 Nov) */
.ctitems { display: flex; flex-direction: column; gap: 10px; }
.ctrow { display: grid; grid-template-columns: 22px 96px minmax(0, 1fr) 190px; gap: 12px; align-items: start; border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: var(--card); }
.ctrow.cthead { grid-template-columns: 22px minmax(0, 1fr) 190px; background: var(--soft); border-inline-start: 5px solid var(--accent); }
.ctrow.cthidden { opacity: .5; } .ctrow.ctmissing { border-color: var(--rem-t); }
.ctrow.dragging { opacity: .4; } .ctrow.dropto { outline: 2px dashed var(--accent); outline-offset: 2px; }
.cthandle { cursor: grab; color: var(--muted); font-weight: 800; letter-spacing: -2px; user-select: none; padding-top: 8px; text-align: center; }
.ctimg img, .ctimg .ctnoimg { width: 96px; height: 96px; object-fit: contain; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); font-size: 26px; }
.ctmain { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ctfields { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 10px; }
.ctfields textarea { min-height: 44px; }
.ctside { display: flex; flex-direction: column; gap: 4px; align-items: stretch; text-align: end; }
.ctprice { font-size: 20px; color: var(--total-ink, var(--brand)); font-weight: 800; }
.cttools { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; margin-top: 6px; }
.ctchk { font-size: 12px; min-height: 0; }
.ctadd { display: flex; gap: 6px; flex-wrap: wrap; }
.ctpicker { border: 2px solid var(--accent); }
.ctfilters .search { flex: 1 1 260px; }
.ctpicks { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; max-height: 62vh; overflow: auto; padding: 2px; margin-top: 8px; }
.ctpick { display: grid; grid-template-columns: 22px 64px minmax(0, 1fr); gap: 8px; align-items: start; border: 1px solid var(--line); border-radius: 12px; padding: 8px; cursor: pointer; background: var(--card); }
.ctpick.added { background: var(--soft); }
.ctpick .ctimg img, .ctpick .ctimg .ctnoimg { width: 64px; height: 64px; }
.ctpick select { max-width: 100%; font-size: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: var(--input-bg); color: var(--text); }
.ctpickbar { position: sticky; bottom: 0; margin: 8px 0 0; justify-content: flex-end; }
.ctpdfhint { margin: -6px 2px 12px; }
.ctint.new { border-inline-start: 5px solid var(--rem-t); }
.ctnote { margin: 8px 0; }
.ctgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ctcard { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.ctcard img, .ctcard .ctnoimg { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--soft); border-radius: 10px; display: grid; place-items: center; color: var(--muted); font-size: 30px; }
.ctsec { grid-column: 1 / -1; margin: 8px 0 0; color: var(--page-ink); font-size: 17px; }
@media (max-width: 760px) {
  .ctrow { grid-template-columns: 18px 72px minmax(0, 1fr); }
  .ctrow .ctside { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; text-align: start; }
  .ctrow.cthead { grid-template-columns: 18px minmax(0, 1fr); }
  .ctrow.cthead .cttools { grid-column: 1 / -1; }
  .ctimg img, .ctimg .ctnoimg { width: 72px; height: 72px; }
  .ctpicks { grid-template-columns: 1fr; max-height: none; }
  .ctfields { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .ctlist .tablewrap, .ctint .tablewrap { overflow: visible; background: transparent; }
  .ctlist table, .ctlist tbody, .ctlist tr, .ctlist td, .ctint table, .ctint tbody, .ctint tr, .ctint td { display: block; width: 100%; }
  .ctlist thead, .ctint thead { display: none; }
  .ctlist tr, .ctint tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; padding: 6px 10px; background: var(--card); }
  .ctlist td, .ctint td { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; border: 0; padding: 3px 0; text-align: end; }
  .ctlist td[data-l]::before, .ctint td[data-l]::before { content: attr(data-l); font-size: 12px; color: var(--muted); font-weight: 600; text-align: start; flex: none; }
  .ctlist td:empty { display: none; }
}
.cthead input { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--input-bg); color: var(--text); font-weight: 700; min-width: 0; }
.ctrow > *, .ctfields > .field, .ctpick > * { min-width: 0; }
.ctfields select, .ctfields input, .ctfields textarea, .ctpick select { width: 100%; max-width: 100%; }
@media (max-width: 480px) { .ctrow { grid-template-columns: 16px minmax(0, 1fr); } .ctrow .ctimg { grid-column: 2; } .ctrow .ctmain { grid-column: 1 / -1; } .ctfields { grid-template-columns: 1fr; } }
/* Uruk sales-rep link + WhatsApp quotation button (25 Nov) */
.card.secret code.rlurl { display: block; font-size: 14px; letter-spacing: 0; word-break: break-all; }
.btn.wa { color: #128c4a; font-weight: 700; }
