/* Plastmet termékválogató. Visszafogott, munkaeszköz jellegű felület. */

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1c2128;
  --muted: #6b7280;
  --line: #dfe3e8;
  --accent: #1f4e79;
  --yes: #1a7f4b;
  --yes-bg: #e6f4ec;
  --no: #9aa1ab;
  --no-bg: #eef0f3;
  --maybe: #b26a00;
  --maybe-bg: #fdf3e2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

/* ---------- belépés ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}
.login h1 { font-size: 20px; margin: 0 0 4px; }
.login p.sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.login label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.login input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
}
.login input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.login button {
  width: 100%;
  margin-top: 20px;
  padding: 11px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.login button:hover { background: #17395a; }
.error {
  background: #fdecec;
  border: 1px solid #f5bcbc;
  color: #9b1c1c;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 4px;
}

/* ---------- fejléc ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 400; }

.progress {
  flex: 1 1 220px;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.bar {
  flex: 1;
  height: 7px;
  background: #e6e9ed;
  border-radius: 99px;
  overflow: hidden;
  min-width: 80px;
}
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .25s; }

.counts { display: flex; gap: 8px; font-size: 13px; white-space: nowrap; flex-wrap: wrap; }
.pill {
  padding: 3px 9px;
  border-radius: 99px;
  font-weight: 600;
  border: 1px solid transparent;
}
.pill.yes { background: var(--yes-bg); color: var(--yes); }
.pill.no { background: var(--no-bg); color: #525964; }
.pill.maybe { background: var(--maybe-bg); color: var(--maybe); }

.topbar .who { font-size: 13px; color: var(--muted); }
.topbar .who a { margin-left: 10px; }

/* ---------- elrendezés ---------- */

.layout { display: flex; align-items: flex-start; }

.sidebar {
  width: 268px;
  flex: 0 0 268px;
  position: sticky;
  top: 53px;
  max-height: calc(100vh - 53px);
  overflow-y: auto;
  padding: 16px 12px 40px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}
.sidebar h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 18px 8px 8px;
}
.sidebar h2:first-child { margin-top: 0; }

.cat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
}
.cat:hover { background: #f1f3f6; }
.cat.active { background: #e8eef5; color: var(--accent); font-weight: 600; }
.cat .n { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cat .done { width: 6px; height: 6px; border-radius: 99px; background: var(--yes); flex: 0 0 6px; }
.cat .done.part { background: #d0a215; }
.cat .done.none { background: #cfd4da; }

.main { flex: 1; min-width: 0; padding: 18px 20px 80px; }

/* ---------- eszköztár ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar input[type=search] {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  min-width: 200px;
  background: #fff;
  color: var(--ink);
}
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button {
  border: 0;
  background: #fff;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; font-weight: 600; }

.bulk { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.btn {
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
}
.btn:hover { background: #f1f3f6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #17395a; }

.cathead { margin: 0 0 4px; font-size: 20px; }
.cathead + .sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

/* ---------- termékrács ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.card.is-yes { border-color: #8fc9aa; box-shadow: 0 0 0 1px #8fc9aa inset, var(--shadow); }
.card.is-no { opacity: .5; }
.card.is-maybe { border-color: #e5c07b; box-shadow: 0 0 0 1px #e5c07b inset, var(--shadow); }

.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: default;
}
.thumb.has-img { cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; position: relative; }

/* Általános helyőrző. A kép mögött ül, így akkor is ez látszik, ha a kép
   hiányzik vagy nem töltődik be. Soha nem jelenik meg törött kép ikon. */
.thumb .ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #c2c8d0;
  background: #f7f8fa;
  font-size: 11px;
  letter-spacing: .02em;
}
.thumb.has-img .ph { display: none; }

.card .body { padding: 9px 11px 4px; flex: 1; }
.card .name { font-size: 13px; font-weight: 600; line-height: 1.35; margin: 0 0 3px; }
.card .sku { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card .attrs { font-size: 11px; color: var(--muted); margin-top: 4px; }

.choices { display: flex; border-top: 1px solid var(--line); }
.choices button {
  flex: 1;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 8px 2px;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
}
.choices button:last-child { border-right: 0; }
.choices button:hover { background: #f4f6f8; }
.choices button.on.yes { background: var(--yes); color: #fff; font-weight: 600; }
.choices button.on.no { background: #7a838f; color: #fff; font-weight: 600; }
.choices button.on.maybe { background: var(--maybe); color: #fff; font-weight: 600; }

.notebtn {
  border-top: 1px solid var(--line);
  background: #fff;
  border-left: 0; border-right: 0; border-bottom: 0;
  width: 100%;
  padding: 6px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  padding-left: 11px;
}
.notebtn:hover { background: #f4f6f8; }
.notebtn.has { color: var(--accent); font-weight: 600; }

.empty { padding: 60px 20px; text-align: center; color: var(--muted); }

/* ---------- nagy kép ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(12, 16, 22, .82);
  display: none;
  place-items: center;
  z-index: 100;
  padding: 24px;
}
.lightbox.open { display: grid; }
.lightbox img { max-width: min(880px, 92vw); max-height: 86vh; background: #fff; border-radius: 8px; }
.lightbox .cap { color: #fff; text-align: center; margin-top: 12px; font-size: 14px; }

/* ---------- mentés visszajelzés ---------- */

.saved {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #1c2128;
  color: #fff;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 120;
}
.saved.show { opacity: 1; transform: none; }
.saved.err { background: #9b1c1c; }

/* ---------- beszállító választó ---------- */

.supplier-list { display: grid; gap: 14px; }

.supplier {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
a.supplier:hover { border-color: var(--accent); }

.supplier-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.supplier-head h2 { margin: 0 0 3px; font-size: 18px; }
.supplier-head .meta { margin: 0; font-size: 13px; color: var(--muted); }
.supplier-head .go { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--accent); white-space: nowrap; }

.supplier .bar { width: 100%; }
.supplier-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.supplier-stats .open { margin-left: auto; }
.supplier-stats .open.done { color: var(--yes); font-weight: 600; }
.supplier .note { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

.supplier.placeholder { border-style: dashed; box-shadow: none; opacity: .7; }
.supplier.placeholder .supplier-head { margin-bottom: 0; }

/* ---------- admin ---------- */

.table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: 14px; }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tbody tr:hover { background: #f7f8fa; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 28px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- mobil ---------- */

.menu-toggle { display: none; }

@media (max-width: 860px) {
  .layout { display: block; }

  /* A fejléc mobilon két sorba tömörödik, hogy ne egye el a képernyőt:
     felül a márka és a felhasználó, alatta a haladás és a számlálók. */
  .topbar { padding: 7px 12px; gap: 8px; row-gap: 6px; }
  .brand { font-size: 14px; }
  .menu-toggle { display: inline-flex; padding: 5px 9px; }
  .topbar .who { order: 2; margin-left: auto; font-size: 12px; }
  .topbar .who a { margin-left: 8px; }
  .progress { order: 3; flex: 1 1 130px; font-size: 12px; gap: 8px; }
  .counts { order: 4; gap: 5px; }
  .counts .pill { font-size: 11px; padding: 2px 7px; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: 84vw;
    max-width: 320px;
    height: 100vh;
    transform: translateX(-102%);
    transition: transform .2s;
    box-shadow: 0 0 40px rgba(0, 0, 0, .2);
    max-height: none;
    padding-top: 20px;
  }
  .sidebar.open { transform: none; }

  .main { padding: 14px 12px 80px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
  .cathead { font-size: 18px; }
  .toolbar { gap: 8px; }
  .toolbar input[type=search] { flex: 1 1 100%; min-width: 0; }
  .seg button { padding: 7px 10px; font-size: 12px; }
  .bulk { margin-left: 0; width: 100%; }
  .card .name { font-size: 12px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --panel: #1b1f26;
    --ink: #e6e9ee;
    --muted: #98a1ad;
    --line: #2b313a;
    --accent: #6aa5db;
    --yes: #4bbd83;
    --yes-bg: #17342a;
    --no-bg: #23272e;
    --maybe: #d69b3f;
    --maybe-bg: #33291a;
  }
  .login input, .toolbar input[type=search], .seg, .seg button,
  .btn, .card .thumb, .choices button, .notebtn { background: #20252d; }
  .thumb { background: #f4f5f7; }
  .seg button.on, .btn.primary { background: var(--accent); color: #10141a; }
  .bar { background: #2b313a; }
  .cat:hover { background: #232830; }
  .cat.active { background: #263243; }
  .table tbody tr:hover { background: #20252d; }
  .pill.no { color: #b7bec8; }
}
