/* Nabrix Source — brand tokens (navy / soft white from the Nabrix identity; teal values adjustable here) */
:root {
  --navy: #0D1F2F; --deep-teal: #0B5C63; --teal: #12A39A; --mint: #2FD3B8; --soft-white: #F7F7F5;
  --ink: #0D1F2F; --muted: rgba(13,31,47,.62); --line: rgba(13,31,47,.12); --card: #fff; --bg: var(--soft-white);
  --good: #12805C; --warn: #B7791F; --bad: #C0392B; --radius: 14px;
  font-family: 'Cairo', system-ui, sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.6; }
button, input, select { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 17px; margin: 0 0 12px; } h3 { font-size: 15px; margin: 16px 0 8px; }
.muted { color: var(--muted); } .note { background: rgba(18,163,154,.08); border-inline-start: 3px solid var(--teal); padding: 10px 12px; border-radius: 8px; }
.splash { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* buttons & inputs */
.btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 16px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--teal); }
.btn.primary { background: var(--deep-teal); color: #fff; border-color: var(--deep-teal); }
.btn.primary:hover { background: var(--teal); border-color: var(--teal); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--deep-teal); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.block { width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--mint); outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > span { font-weight: 600; font-size: 13px; } .field small { color: var(--muted); font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; } .check input { width: auto; }
input.code { letter-spacing: .3em; text-align: center; font-size: 20px; }
.error { color: var(--bad); font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-end { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; } .span2 { grid-column: 1 / -1; }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark { width: 36px; height: 36px; border-radius: 10px; background: var(--navy); color: var(--mint); display: grid; place-items: center; font-weight: 700; font-family: Arial, sans-serif; }
.brand b { display: block; line-height: 1.1; } .brand small { color: var(--muted); font-size: 12px; }
.brand.big .mark { width: 48px; height: 48px; font-size: 22px; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, var(--navy), var(--deep-teal)); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.auth-card h1 { margin: 20px 0 14px; }
.auth-card .lang { margin-top: 14px; }
#captcha { margin: 6px 0; }

/* shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
aside { background: var(--navy); color: #fff; padding: 18px 14px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
aside .brand small, aside .muted { color: rgba(255,255,255,.6); }
aside .company, aside .company-name { background: rgba(255,255,255,.08); border: 0; color: #fff; padding: 8px 10px; border-radius: 10px; font-weight: 600; }
aside .company option { color: var(--ink); }
aside nav { display: flex; flex-direction: column; gap: 2px; }
aside nav button { text-align: start; background: none; border: 0; color: rgba(255,255,255,.8); padding: 9px 12px; border-radius: 10px; cursor: pointer; }
aside nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
aside nav button.on { background: rgba(47,211,184,.16); color: var(--mint); font-weight: 700; }
.aside-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.aside-foot .btn.ghost { color: var(--mint); }
main { padding: 22px 28px; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.burger { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; }

/* cards, kpis, tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi small { color: var(--muted); display: block; } .kpi b { font-size: 26px; } .kpi span { color: var(--muted); margin-inline-start: 6px; }
.kpi.warn { border-color: var(--warn); } .kpi.warn b { color: var(--warn); }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar select { width: auto; min-width: 160px; } .search { max-width: 320px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #FBFBFA; }
tbody tr:hover { background: rgba(18,163,154,.04); }
tfoot td { font-weight: 700; }
td.num { font-variant-numeric: tabular-nums; } td.num small { color: var(--muted); }
td.pos { color: var(--good); } td.neg { color: var(--bad); }
tr.dim { opacity: .55; } tr.warn td { background: rgba(183,121,31,.07); } tr.bad td { background: rgba(192,57,43,.07); }
.empty { padding: 36px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
.tag { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(13,31,47,.06); }
.tag.serial { background: rgba(11,92,99,.1); color: var(--deep-teal); } .tag.batch { background: rgba(183,121,31,.12); color: var(--warn); }
.tag.s-available, .tag.d-received, .tag.d-posted { background: rgba(18,128,92,.12); color: var(--good); }
.tag.s-in_transit, .tag.d-in_transit { background: rgba(18,163,154,.12); color: var(--deep-teal); }
.tag.s-scrapped, .tag.d-cancelled { background: rgba(192,57,43,.1); color: var(--bad); }
.tabs { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tabs button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.tabs button.on { background: var(--navy); color: #fff; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 4px 0 0; } .facts dt { color: var(--muted); } .facts dd { margin: 0; font-weight: 600; }

/* wizard */
.wizard { max-width: 760px; margin: 0 auto; padding: 32px 16px; }
.wiz-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.steps { display: flex; gap: 6px; } .steps span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); font-weight: 700; }
.steps span.on { background: var(--deep-teal); color: #fff; border-color: var(--deep-teal); }
.choices { display: grid; gap: 10px; margin-bottom: 12px; }
.choice { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.choice input { width: auto; margin-top: 6px; } .choice small { display: block; color: var(--muted); }
.choice.on { border-color: var(--teal); background: rgba(18,163,154,.06); }

/* modal (closes only via ×) */
.overlay { position: fixed; inset: 0; background: rgba(13,31,47,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; }
.modal.wide { max-width: 820px; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 0; }
.modal .x { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-body { padding: 18px; overflow: auto; }
.lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.line { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; align-items: center; }

.toast { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
[dir=rtl] .toast { transform: translateX(50%); }
.toast.bad { background: var(--bad); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  aside { position: fixed; inset-block: 0; inset-inline-start: 0; width: 260px; z-index: 40; transform: translateX(100%); transition: transform .2s; }
  [dir=ltr] aside { transform: translateX(-100%); }
  .shell.menu-open aside { transform: none; }
  .burger { display: block; }
  main { padding: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; } .cols, .grid2 { grid-template-columns: 1fr; }
  .line { grid-template-columns: 1fr 1fr; }
}
