:root {
  --ink: #0f2233;
  --ink-2: #1d3a52;
  --paper: #eef1ee;
  --card: #ffffff;
  --line: #d3dad5;
  --muted: #5b6a74;
  --signal: #f2b705;
  --ok: #1d7a4b;
  --bad: #c0392b;
  --van: #2563a8;
  --radius: 10px;
  --head: 56px;
  font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html, body { margin: 0; min-height: 100%; background: var(--paper); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- header ---------- */
.head {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  height: var(--head); display: flex; align-items: center; gap: 4px;
  padding: 0 6px; background: var(--ink); color: #fff;
}
.head h1 { flex: 1; margin: 0 6px; font-size: 19px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head .stamp { width: 6px; height: 26px; background: var(--signal); border-radius: 2px; margin-left: 6px; }
.icon-btn {
  width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: inherit;
  display: grid; place-items: center; font-size: 22px; line-height: 1;
}
.icon-btn:active { background: rgba(255,255,255,.14); }
.icon-btn svg { width: 24px; height: 24px; }

/* ---------- login ---------- */
.login {
  min-height: 100vh; min-height: 100dvh; background: var(--ink); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.brand b { font-size: 26px; letter-spacing: .5px; }
.brand i { width: 8px; height: 30px; background: var(--signal); border-radius: 2px; }
.login p { margin: 0 0 22px; color: #b9c7d2; }
.dots { display: flex; gap: 14px; height: 22px; margin-bottom: 10px; }
.dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #7f95a6; }
.dots span.on { background: var(--signal); border-color: var(--signal); }
.login .err { min-height: 22px; color: #ffb4a8; margin-bottom: 8px; text-align: center; }
.pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; }
.pad button {
  height: 64px; border: 0; border-radius: 12px; background: var(--ink-2); color: #fff; font-size: 26px; font-weight: 500;
}
.pad button:active { background: #2c5373; }
.pad .go { background: var(--signal); color: var(--ink); }
.pad .go:active { background: #ffd23f; }

/* ---------- home ---------- */
.home { padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  min-height: 92px; padding: 14px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  text-align: left; display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
}
.tile b { font-size: 17px; }
.tile small { color: var(--muted); font-size: 13px; }
.tile.primary { background: var(--ink); color: #fff; border-color: var(--ink); grid-column: span 2; min-height: 84px; }
.tile.primary small { color: #b9c7d2; }
.tile.primary b::before { content: ""; display: inline-block; width: 6px; height: 16px; background: var(--signal); margin-right: 8px; vertical-align: -2px; border-radius: 2px; }
.tile:disabled { opacity: .5; }
.tile:not(:disabled):active { transform: scale(.98); }
.who { padding: 4px 16px 18px; color: var(--muted); font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.link-btn { border: 0; background: none; color: var(--bad); padding: 8px; font-weight: 500; }

/* ---------- stock ---------- */
.tools {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--head)); z-index: 15;
  background: var(--paper); padding: 10px 10px 6px; border-bottom: 1px solid var(--line);
}
.search { display: flex; align-items: center; gap: 6px; background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); padding: 0 4px 0 12px; }
.search:focus-within { border-color: var(--signal); box-shadow: 0 0 0 3px rgba(242,183,5,.25); }
.search input { flex: 1; min-width: 0; height: 46px; border: 0; outline: 0; background: transparent; font-size: 17px; }
.search .icon-btn { width: 40px; height: 40px; color: var(--muted); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--card);
  font-size: 14px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .k { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chip .k.van { background: var(--van); }
.chip .k.defective { background: var(--bad); }
.chip .k.main { background: var(--signal); }
.chip.warn.on { background: var(--bad); border-color: var(--bad); }
.meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; padding: 6px 2px 0; }

.list { padding-bottom: 30px; }
.cat {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--head) + var(--tools-h, 132px)); z-index: 5;
  padding: 7px 14px; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  background: #e1e7e2; color: var(--ink-2); border-bottom: 1px solid var(--line);
}
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; width: 100%;
  padding: 11px 14px; background: var(--card); border: 0; border-bottom: 1px solid var(--line); text-align: left;
  border-left: 5px solid transparent;
}
.row:active { background: #f6f3e4; }
.row.low { border-left-color: var(--bad); }
.row .t { font-size: 16px; font-weight: 500; line-height: 1.25; }
.row .s { font-size: 13px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .q { text-align: right; }
.row .q b { font-size: 22px; font-weight: 700; }
.row .q small { display: block; font-size: 12px; color: var(--muted); }
.row.low .q b { color: var(--bad); }
.row.zero .q b { color: #9aa6ae; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: var(--ink); color: #fff; margin-left: 6px; vertical-align: 2px; }
.empty, .loading { padding: 40px 20px; text-align: center; color: var(--muted); }
.more { display: block; width: calc(100% - 28px); margin: 14px; height: 44px; border: 1px dashed var(--muted); border-radius: var(--radius); background: none; color: var(--muted); }

/* ---------- product sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; background: var(--paper); overflow-y: auto; animation: up .16s ease-out; }
@keyframes up { from { transform: translateY(24px); opacity: .4; } }
.sheet-body { padding: 14px; display: grid; gap: 12px; padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card h3 { margin: 0; padding: 10px 14px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-2); background: #f3f5f3; border-bottom: 1px solid var(--line); }
.prod-title { padding: 14px; }
.prod-title h2 { margin: 0 0 6px; font-size: 20px; line-height: 1.25; }
.prod-title .s { color: var(--muted); font-size: 14px; word-break: break-all; }
.prod-total { display: flex; align-items: baseline; gap: 6px; padding: 0 14px 14px; }
.prod-total b { font-size: 34px; }
.line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .q { font-weight: 700; font-size: 17px; }
.serials { padding: 4px 14px 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.serials code { font-family: ui-monospace, "Roboto Mono", monospace; font-size: 13px; background: #f1f3f1; border: 1px solid var(--line); padding: 3px 7px; border-radius: 5px; }
.mv { padding: 10px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.mv:last-child { border-bottom: 0; }
.mv .d { font-size: 13px; color: var(--muted); }
.mv .l { font-size: 14px; }
.mv .q { grid-row: span 2; align-self: center; font-weight: 700; font-size: 17px; }
.mv .q.plus { color: var(--ok); }
.mv .q.minus { color: var(--bad); }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px);
  max-width: calc(100% - 24px); padding: 12px 16px; border-radius: 10px; background: var(--ink); color: #fff;
  font-size: 15px; opacity: 0; pointer-events: none; transition: .18s; z-index: 60;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--bad); }
#toast.ok { background: var(--ok); }

/* ---------- μεγάλες οθόνες ---------- */
@media (min-width: 800px) {
  .home { grid-template-columns: repeat(4, 1fr); max-width: 1000px; margin: 0 auto; }
  .tile.primary { grid-column: span 4; }
  .who { max-width: 1000px; margin: 0 auto; }
  .tools, .list { max-width: 1000px; margin-left: auto; margin-right: auto; }
  .sheet-body { max-width: 760px; margin: 0 auto; }
}

/* ---------- κουμπιά & πεδία ---------- */
.btn {
  height: 46px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card);
  font-weight: 600; font-size: 15px;
}
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: .45; }
.btn:not(:disabled):active { transform: scale(.98); }
.icon-btn.sm { width: 36px; height: 36px; color: var(--muted); }
.icon-btn.sm svg { width: 18px; height: 18px; }
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select {
  height: 46px; padding: 0 12px; border: 1px solid #b9c3bc; border-radius: 8px; background: #fff; font-size: 16px; width: 100%;
}
.field input:focus, .field select:focus { outline: 0; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(242,183,5,.3); }
.field input.big { height: 60px; font-size: 28px; text-align: center; font-weight: 700; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #b9c3bc; border-radius: 8px; overflow: hidden; }
.seg button { height: 44px; border: 0; background: #fff; font-size: 14px; }
.seg button.on { background: var(--ink); color: #fff; font-weight: 600; }
.hint { color: var(--muted); font-size: 14px; }

/* ---------- παράθυρα ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(15,34,51,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-box {
  width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--paper);
  border-radius: 16px 16px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px)); animation: up .16s ease-out;
}
@media (min-width: 600px) { .modal { align-items: center; } .modal-box { border-radius: 16px; } }
.modal-box h2 { margin: 0 0 12px; font-size: 20px; }
.modal-box p { margin: 0 0 12px; }
.code-box {
  font-family: ui-monospace, "Roboto Mono", monospace; font-size: 17px; font-weight: 700; word-break: break-all;
  background: #fff; border: 2px dashed var(--ink); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px;
}
.code-box.plain { font-family: inherit; font-weight: 400; border-style: solid; border-width: 1px; border-color: var(--line); }
.btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.btns .btn { flex: 1; }
.btns.col { flex-direction: column; }
.pick { max-height: 45vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 8px; }
.pick .hint { padding: 14px; }
.pick-row { display: block; width: 100%; text-align: left; padding: 11px 12px; border: 0; border-bottom: 1px solid var(--line); background: #fff; }
.pick-row:last-child { border-bottom: 0; }
.pick-row:active { background: #f6f3e4; }
.pick-row small { display: block; color: var(--muted); margin-top: 2px; }
.modal .loading { padding: 20px; }

/* ---------- εισαγωγή ---------- */
.rxlist { padding: 10px 10px calc(96px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 10px; }
.rxline { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.rxline.active { border-left-color: var(--signal); box-shadow: 0 0 0 2px rgba(242,183,5,.35); }
.rxline.err { border-left-color: var(--bad); }
.rxhead { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.rxhead .t { font-size: 16px; font-weight: 600; line-height: 1.25; }
.rxhead .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.rxrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.lerr { color: var(--bad); font-size: 14px; margin-top: 6px; font-weight: 500; }
.stepper { display: flex; align-items: stretch; border: 1px solid #b9c3bc; border-radius: 8px; overflow: hidden; }
.stepper button { min-width: 48px; height: 44px; border: 0; background: #f3f5f3; font-size: 22px; font-weight: 600; }
.stepper .qv { min-width: 92px; background: #fff; font-size: 17px; font-weight: 700; border-left: 1px solid #b9c3bc; border-right: 1px solid #b9c3bc; }
.sn { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sn code {
  display: inline-flex; align-items: center; gap: 2px; font-family: ui-monospace, "Roboto Mono", monospace; font-size: 13px;
  background: #f1f3f1; border: 1px solid var(--line); padding: 2px 2px 2px 7px; border-radius: 5px;
}
.sn code button { border: 0; background: none; color: var(--muted); font-size: 16px; width: 26px; height: 26px; }
.rxprice { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); display: grid; gap: 4px; }
.rxprice label { font-size: 13px; color: var(--ink-2); font-weight: 600; display: grid; gap: 4px; }
.rxprice input[type=number] { height: 42px; padding: 0 10px; border: 1px solid #b9c3bc; border-radius: 8px; font-size: 16px; max-width: 180px; }
.rxprice small { color: var(--muted); font-size: 12px; }
.rxprice .chk { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-top: 4px; }
.rxprice .chk input { width: 20px; height: 20px; }
.banner {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--head) + var(--tools-h, 110px)); z-index: 6;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin: 10px 10px 0; padding: 10px 12px; background: var(--signal); color: var(--ink); border-radius: var(--radius); font-size: 14px;
}
.banner .btn { background: var(--ink); color: #fff; border-color: var(--ink); }
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: 8px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--card); border-top: 1px solid var(--line);
}
.bar input { flex: 1; min-width: 0; height: 48px; padding: 0 12px; border: 1px solid #b9c3bc; border-radius: 8px; font-size: 15px; }
.bar .btn { height: 48px; white-space: nowrap; }
@media (min-width: 800px) {
  .rxlist { max-width: 1000px; margin: 0 auto; }
  .banner { max-width: 980px; margin: 10px auto 0; }
}
