@font-face { font-family: "Inter"; src: url("fonts/Inter-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --accent: #2445E8;
  --accent-deep: #1B34B5;
  --accent-tint: #EEF1FE;
  --bg: #F4F5F8;
  --card: #FFFFFF;
  --ink: #121624;
  --body: #2A3040;
  --muted: #6A7184;
  --line: #E3E6EE;
  --ok: #17803D;
  --ok-tint: #E7F6EC;
  --warn: #B8431A;
  --warn-tint: #FFF0E9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(18, 22, 36, 0.06), 0 4px 16px rgba(18, 22, 36, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
/* iPhone mărește singur pagina când atingi un câmp cu text sub 16px și o lasă mărită
   (de aici scroll-ul în lateral și butoanele tăiate pe margine). La 16px nu mai face asta. */
input, select, textarea { font-size: 16px; }
button { cursor: pointer; }

#app { max-width: 520px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: 0; }
.userchip {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--body);
}
.serie {
  font-weight: 700; font-size: 12px; letter-spacing: 0.04em;
  color: var(--accent-deep); background: var(--accent-tint);
  padding: 3px 8px; border-radius: 999px;
}
.linkbtn { background: none; border: none; color: var(--muted); font-size: 13px; padding: 6px; text-decoration: underline; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;   /* cele 5 file ale lui Robert încap pe ecranul telefonului, fără scroll în lateral */
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 6px 8px; font-size: 13px; font-weight: 500; color: var(--body);
}
@media (max-width: 370px) { .tab { padding: 6px 7px; font-size: 12.5px; } }
.tab.active { background: var(--ink); border-color: var(--ink); color: #fff; }

main { flex: 1; padding: 14px 16px 120px; }

/* ---------- cards & fields ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.step { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
h1 { font-size: 22px; letter-spacing: -0.02em; margin: 6px 0 4px; }
.sub { color: var(--muted); margin: 0 0 16px; }

.search {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; background: #fff; outline: none;
}
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }

.list { margin-top: 8px; max-height: 280px; overflow-y: auto; }
.row-btn {
  display: flex; width: 100%; text-align: left; align-items: center; justify-content: space-between; gap: 10px;
  border: none; background: none; padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.row-btn:last-child { border-bottom: none; }
.row-btn:hover { background: var(--bg); }
.row-title { font-weight: 600; }
.row-meta { font-size: 13px; color: var(--muted); }

.picked { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.picked .row-title { font-size: 16px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 11px; font-size: 13px; color: var(--body); }
.chip.active { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-deep); font-weight: 600; }

.product { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.product:last-child { border-bottom: none; }
.product > div:first-child { flex: 1; min-width: 0; }   /* numele lungi se rup pe rânduri, butoanele rămân în chenar */
.product .row-title { font-weight: 500; }
.product.on .row-title { font-weight: 700; }

.stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.stepper button {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-size: 20px; line-height: 1; font-weight: 600; color: var(--ink);
}
.stepper button.plus { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper input {
  width: 46px; height: 36px; text-align: center; border: 1px solid var(--line); border-radius: 10px; font-weight: 700;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

textarea.search { min-height: 70px; resize: vertical; }

/* ---------- bottom bar ---------- */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.bottombar .inner { max-width: 488px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.summary { flex: 1; font-size: 14px; color: var(--body); }
.summary b { color: var(--ink); }
.primary {
  border: none; border-radius: 12px; padding: 13px 20px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
}
.primary:disabled { background: #B9C2EE; cursor: not-allowed; }
.secondary {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px;
  background: #fff; font-weight: 600;
}
.full { width: 100%; }

/* ---------- login ---------- */
.login { padding: 40px 20px; }
.login .card { padding: 22px; }
.login label { display: block; font-size: 13px; font-weight: 600; color: var(--body); margin: 14px 0 6px; }
.demo-users { display: grid; gap: 8px; margin-top: 8px; }
.demo-user { text-align: left; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; }
.error { color: var(--warn); font-size: 14px; margin-top: 10px; }

/* ---------- success ---------- */
.success { text-align: center; padding: 28px 18px; }
.success .tick {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px;
  background: var(--ok-tint); color: var(--ok); font-size: 34px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.success .actions { display: grid; gap: 10px; margin-top: 20px; }

/* ---------- orders ---------- */
.order { padding: 12px 0; border-bottom: 1px solid var(--line); }
.order:last-child { border-bottom: none; }
.order-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pill { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.pill { background: var(--bg); color: var(--muted); }
.pill.ok { background: var(--ok-tint); color: var(--ok); }
.pill.warn { background: var(--warn-tint); color: var(--warn); }
.lines { margin: 8px 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--body); }
.lines li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.lines .amount { white-space: nowrap; }
.src { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-left: 6px; }
.src.special { color: var(--accent-deep); }
.src.missing { color: var(--warn); }
.total { display: flex; justify-content: space-between; font-weight: 700; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }

details.payload { margin-top: 10px; }
details.payload summary { font-size: 13px; color: var(--accent-deep); cursor: pointer; font-weight: 600; }
details.payload pre {
  font-size: 11.5px; line-height: 1.4; background: #0F1324; color: #DDE3FF;
  padding: 12px; border-radius: 10px; overflow-x: auto; margin: 8px 0 0;
}

/* ---------- report ---------- */
table.report { width: 100%; border-collapse: collapse; font-size: 14px; }
table.report th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.report td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
table.report td.num, table.report th.num { text-align: right; white-space: nowrap; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.kpi .v { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.kpi .l { font-size: 13px; color: var(--muted); }
.note { font-size: 13px; color: var(--muted); background: var(--accent-tint); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 14px; font-size: 14px; z-index: 30;
}

/* ---------- zile ---------- */
.daybar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.daybar .secondary { padding: 8px 14px; font-size: 18px; line-height: 1; }
.daybar .secondary:disabled { opacity: 0.35; cursor: default; }
.dayname { text-align: center; font-weight: 700; font-size: 16px; }
.dayname .linkbtn { display: block; margin: 2px auto 0; font-size: 12px; font-weight: 500; }
.secondary.full { margin-top: 4px; }

select.search { appearance: auto; }
.kpi .v { overflow-wrap: anywhere; }

/* ---------- „În curând” ---------- */
.soon { position: relative; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent-deep); background: var(--accent-tint); border-radius: 999px; padding: 4px 10px; }
.blur { filter: blur(6px); opacity: 0.55; pointer-events: none; user-select: none; margin-top: 4px; }

/* ---------- antetul listei de comenzi, cu „Actualizează” ---------- */
.lista-antet { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.lista-antet .step { margin: 0; }
.lista-antet .linkbtn { text-decoration: none; color: var(--accent-deep); font-weight: 600; padding: 4px 0; }

/* ---------- stoc ---------- */
.stoc-eticheta { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
.stoc-eticheta.ok { background: var(--ok-tint); color: var(--ok); }
.stoc-eticheta.redus { background: #FFF4DB; color: #8A5A00; }
.stoc-eticheta.epuizat { background: var(--warn-tint); color: var(--warn); }
.stoc-cifra .stoc-eticheta { margin: 4px 0 0; }
.kpis.trei { grid-template-columns: repeat(3, 1fr); }
.kpis.trei .kpi { padding: 12px; }
.actiuni-stoc { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.actiuni-stoc button { text-align: left; padding: 11px 13px; }
.actiuni-stoc .t { display: block; font-weight: 700; }
.actiuni-stoc .d { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.stoc-rand { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stoc-rand:last-child { border-bottom: none; }
.stoc-rand > div:first-child { flex: 1; min-width: 0; }
.stoc-cifra { text-align: right; white-space: nowrap; }
.stoc-cifra b { font-size: 17px; }
.miscare { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.miscare:last-child { border-bottom: none; }
.miscare .cant { font-weight: 700; white-space: nowrap; }
.miscare .cant.plus { color: var(--ok); }
.miscare .cant.minus { color: var(--warn); }
.inventar-input { width: 78px; height: 38px; text-align: center; border: 1px solid var(--line); border-radius: 10px; font-weight: 700; flex: none; }

/* ---------- comutatorul firmă / bon ---------- */
.comutator { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.comutator button { border: none; background: none; border-radius: 9px; padding: 9px 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.comutator button.activ { background: var(--accent-tint); color: var(--accent-deep); }
