/* Haldelain Equipment — Web-Designsystem haldelain.ch
   Grund #050505 · Elektroblau #0061FF · Roboto 300/500/700 */

:root {
  --bg: #050505;
  --bg-2: #0c0c0c;
  --bg-3: #131313;
  --blue: #0061FF;
  --blue-h: #2F87FF;
  --white: #ffffff;
  --muted: rgba(255, 255, 255, .5);
  --muted-2: rgba(255, 255, 255, .32);
  --line: rgba(255, 255, 255, .1);
  --line-2: rgba(255, 255, 255, .18);
  --soft: rgba(255, 255, 255, .05);
  --red: #FF4D4D;
  --amber: #FFB020;
  --green: #35C46A;
  --r-btn: 4px;
  --r-media: 6px;
  --nav-h: 64px;
  --tab-h: 64px;
  --font: 'Roboto', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
::selection { background: var(--blue); color: #fff; }

/* ---------- Layout ---------- */
.nav {
  position: sticky; top: 0; z-index: 30;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px;
  background: rgba(5, 5, 5, .86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav .brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.nav .brand img { width: 26px; height: 26px; }
.nav .brand span { font-weight: 700; text-transform: uppercase; letter-spacing: -.02em; font-size: 18px; }
.nav .links { display: none; gap: 4px; margin-left: 8px; }
.nav .links button {
  background: none; border: 0; padding: 10px 14px; cursor: pointer;
  text-transform: uppercase; font-size: 13.6px; font-weight: 500; color: var(--muted);
  border-radius: var(--r-btn);
}
.nav .links button:hover { color: #fff; background: var(--soft); }
.nav .links button.active { color: #fff; }
.nav .spacer { flex: 1; }
.nav .who {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-btn); padding: 6px 12px 6px 6px;
  background: transparent; font-weight: 500; font-size: 13.6px;
}
.nav .who .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.sync { font-size: 12px; color: var(--muted-2); display: none; }

main { padding: 24px 16px calc(var(--tab-h) + 32px); max-width: 1240px; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(5, 5, 5, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 10.5px; text-transform: uppercase; font-weight: 500; letter-spacing: 0;
}
.tabbar button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.tabbar button.active { color: #fff; }
.tabbar button.active svg { stroke: var(--blue-h); }

@media (min-width: 900px) {
  .nav .links { display: flex; }
  .tabbar { display: none; }
  main { padding: 40px 32px 80px; }
  .sync { display: block; }
}

/* ---------- Typography ---------- */
h1 {
  font-weight: 700; text-transform: uppercase; letter-spacing: -.03em; line-height: 1;
  font-size: 40px; margin: 0 0 8px;
}
h1 .light { font-weight: 300; display: block; }
h2 {
  font-size: 26px; line-height: 1.05; text-transform: uppercase; letter-spacing: -.02em;
  font-weight: 500; margin: 0 0 16px;
}
h2 .light { font-weight: 300; display: block; }
h3 { font-size: 16px; font-weight: 500; margin: 0 0 8px; }
.lead { color: var(--muted); max-width: 640px; margin: 0 0 24px; }
.num { font-size: 20px; font-weight: 300; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
@media (min-width: 900px) {
  h1 { font-size: 56px; }
  h2 { font-size: 32px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: var(--r-btn); border: 0; cursor: pointer;
  background: var(--blue); color: #fff; text-transform: uppercase; font-size: 13.6px; font-weight: 500;
  text-decoration: none; white-space: nowrap; transition: background .15s;
}
.btn:hover { background: var(--blue-h); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: var(--soft); }
.btn.secondary:hover { background: rgba(255, 255, 255, .1); }
.btn.ghost { background: transparent; border: 1px solid var(--line-2); }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { background: transparent; border: 1px solid rgba(255, 77, 77, .5); color: var(--red); }
.btn.danger:hover { background: rgba(255, 77, 77, .12); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 12px; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.iconbtn {
  width: 40px; height: 40px; border-radius: var(--r-btn); border: 1px solid var(--line); background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--muted);
}
.iconbtn:hover { color: #fff; background: var(--soft); }
.iconbtn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: var(--r-btn);
  background: var(--bg-2); border: 1px solid var(--line); color: #fff; outline: none;
  -webkit-appearance: none; appearance: none;
}
textarea.input { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; }
.input:focus { border-color: var(--blue); }
.input::placeholder { color: var(--muted-2); }
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input[type="date"].input { color-scheme: dark; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 10px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 15px; width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; }
.search .input { padding-left: 42px; }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; height: 36px; padding: 0 14px; border-radius: var(--r-btn); cursor: pointer;
  background: var(--soft); border: 1px solid transparent; color: var(--muted); font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.chip:hover { color: #fff; }
.chip.active { background: var(--blue); color: #fff; }
.chip .n { opacity: .6; font-weight: 300; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(5, 1fr); } }

.card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-media);
  overflow: hidden; cursor: pointer; transition: border-color .15s, transform .15s;
  display: flex; flex-direction: column; position: relative;
}
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card .media {
  aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 14%;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .06), transparent 62%), var(--bg-2);
}
.card .media img { max-height: 100%; max-width: 100%; object-fit: contain; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .55)); }
.card .media .ph { width: 44%; opacity: .25; }
.card .body { padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.card .brand { font-size: 12px; color: var(--muted); }
.card .name { font-weight: 500; font-size: 14px; line-height: 1.3; margin: 2px 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.card .qty { font-weight: 500; color: #fff; }
.card.dim { opacity: .55; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 3px;
  font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0;
  background: var(--soft); color: var(--muted);
}
.badge.ok { color: var(--green); background: rgba(53, 196, 106, .12); }
.badge.res { color: var(--blue-h); background: rgba(0, 97, 255, .16); }
.badge.out { color: var(--amber); background: rgba(255, 176, 32, .14); }
.badge.bad { color: var(--red); background: rgba(255, 77, 77, .14); }
.badge.svc { color: var(--amber); background: rgba(255, 176, 32, .14); }
.badge.lost { color: var(--red); background: rgba(255, 77, 77, .14); }
.badge.corner { position: absolute; top: 10px; left: 10px; }

/* ---------- Panels & lists ---------- */
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-media); padding: 18px; margin-bottom: 16px; }
.panel.flat { background: transparent; }
.section { margin: 36px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; }
.list { border-top: 1px solid var(--line); }
.list .item {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.list .item .thumb { width: 56px; height: 56px; border-radius: var(--r-media); background: var(--bg-3); display: grid; place-items: center; padding: 6px; }
.list .item .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.list .item .thumb .ph { width: 40%; opacity: .3; }
.list .item .t { font-weight: 500; font-size: 15px; line-height: 1.3; }
.list .item .s { color: var(--muted); font-size: 13px; }
.list .item.static { cursor: default; }
.list .item.plain { grid-template-columns: 1fr auto; }
.list.compact .item { padding: 10px 0; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; border: 1px dashed var(--line); border-radius: var(--r-media); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 24px 0 8px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .stats { grid-template-columns: repeat(6, 1fr); } }
.stat { border: 1px solid var(--line); border-radius: var(--r-media); padding: 16px; cursor: pointer; background: var(--bg-2); }
.stat:hover { border-color: var(--line-2); }
.stat .v { font-size: 36px; font-weight: 300; line-height: 1; margin-bottom: 6px; }
.stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; font-weight: 500; }
.stat.bad .v { color: var(--red); }
.stat.blue .v { color: var(--blue-h); }

.hero { position: relative; padding: 8px 0 8px; }
body.glow { background: radial-gradient(640px 520px at -80px 120px, rgba(0, 97, 255, .22), rgba(0, 97, 255, 0) 100%) no-repeat, var(--bg); }

.progress { height: 4px; background: var(--soft); border-radius: 2px; overflow: hidden; margin: 10px 0 4px; }
.progress i { display: block; height: 100%; background: var(--blue); transition: width .2s; }

.twocol { display: grid; gap: 24px; }
@media (min-width: 1000px) { .twocol { grid-template-columns: 1.4fr 1fr; } }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.kv a { color: var(--blue-h); text-decoration: none; }
.kv a:hover { text-decoration: underline; }

.note { background: rgba(0, 97, 255, .1); border: 1px solid rgba(0, 97, 255, .35); border-radius: var(--r-btn); padding: 12px 14px; font-size: 14px; }
.note.warn { background: rgba(255, 176, 32, .1); border-color: rgba(255, 176, 32, .4); }
.note.bad { background: rgba(255, 77, 77, .1); border-color: rgba(255, 77, 77, .4); }

/* ---------- Sheet / modal ---------- */
.sheet { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.sheet::-webkit-scrollbar { width: 6px; }
.sheet::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }
.picker { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6);
  display: none; align-items: flex-end; justify-content: center;
}
.overlay.open { display: flex; }
.sheet {
  width: 100%; max-height: 92dvh; overflow-y: auto; background: var(--bg-2);
  border-top-left-radius: 14px; border-top-right-radius: 14px; border: 1px solid var(--line);
  padding: 8px 18px calc(24px + env(safe-area-inset-bottom));
  animation: up .2s ease-out;
}
.sheet .grab { width: 40px; height: 4px; background: var(--line-2); border-radius: 2px; margin: 6px auto 14px; }
.sheet .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet .head h2 { margin: 0; font-size: 22px; }
.sheet .hero-img {
  aspect-ratio: 16 / 10; display: grid; place-items: center; padding: 6%;
  background: radial-gradient(circle at 50% 50%, rgba(0, 97, 255, .16), transparent 62%), var(--bg-3);
  border-radius: var(--r-media); margin-bottom: 16px;
}
.sheet .hero-img img { max-height: 100%; max-width: 100%; object-fit: contain; filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .6)); }
.sheet .hero-img .ph { width: 20%; opacity: .25; }
.sheet .actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.sheet .actions .btn { flex: 1 1 auto; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 900px) {
  .overlay { align-items: center; }
  .sheet { width: 720px; max-height: 88vh; border-radius: 10px; padding: 8px 28px 28px; }
  .sheet .grab { display: none; }
  .sheet .head { padding-top: 16px; }
}

.seg { display: grid; grid-auto-flow: column; gap: 4px; background: var(--soft); border-radius: var(--r-btn); padding: 4px; }
.seg button { height: 38px; border: 0; background: transparent; color: var(--muted); border-radius: 3px; cursor: pointer; font-size: 13px; font-weight: 500; text-transform: uppercase; }
.seg button.active { background: var(--blue); color: #fff; }
.seg button.bad.active { background: var(--red); }
.seg button.warn.active { background: var(--amber); color: #000; }

/* picker */
.picker { border: 1px solid var(--line); border-radius: var(--r-media); max-height: 46dvh; overflow-y: auto; }
.picker .cat { padding: 10px 14px 4px; font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.picker .prow { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.picker .prow .thumb { width: 40px; height: 40px; border-radius: 4px; background: var(--bg-3); display: grid; place-items: center; padding: 4px; }
.picker .prow .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.picker .prow .n { font-size: 14px; font-weight: 500; line-height: 1.25; }
.picker .prow .a { font-size: 12px; color: var(--muted); }
.picker .prow .a.bad { color: var(--red); }
.stepper { display: inline-grid; grid-auto-flow: column; align-items: center; border: 1px solid var(--line); border-radius: var(--r-btn); }
.stepper button { width: 34px; height: 34px; border: 0; background: transparent; color: #fff; cursor: pointer; font-size: 18px; }
.stepper button:disabled { color: var(--muted-2); }
.stepper span { min-width: 26px; text-align: center; font-weight: 500; font-size: 14px; }
.stepper.on { border-color: var(--blue); background: rgba(0, 97, 255, .16); }

/* checklist rows */
.crow { display: grid; grid-template-columns: 28px 44px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.crow input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--blue); }
.crow .thumb { width: 44px; height: 44px; border-radius: 4px; background: var(--bg-3); display: grid; place-items: center; padding: 4px; }
.crow .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.crow .n { font-size: 14px; font-weight: 500; }
.crow .s { font-size: 12px; color: var(--muted); }
.crow.done .n { color: var(--muted); text-decoration: line-through; }
.crow .rstate { display: inline-grid; grid-auto-flow: column; gap: 2px; }
.crow .rstate button { width: 34px; height: 34px; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 3px; cursor: pointer; font-size: 14px; }
.crow .rstate button.on.ok { background: rgba(53, 196, 106, .18); color: var(--green); border-color: transparent; }
.crow .rstate button.on.bad { background: rgba(255, 77, 77, .18); color: var(--red); border-color: transparent; }
.crow .rstate button.on.lost { background: rgba(255, 176, 32, .18); color: var(--amber); border-color: transparent; }

/* toasts */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 16px); transform: translateX(-50%); z-index: 60;
  background: #fff; color: #000; padding: 10px 16px; border-radius: var(--r-btn); font-size: 14px; font-weight: 500; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
@media (min-width: 900px) { .toast { bottom: 24px; } }

.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate .box { width: 100%; max-width: 380px; }
.hidden { display: none !important; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.tag { font-size: 12px; color: var(--muted); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .d { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 4px; padding: 4px; font-size: 11px; color: var(--muted); position: relative; cursor: pointer; }
.cal .d.today { border-color: var(--blue); color: #fff; }
.cal .d .c { position: absolute; right: 4px; bottom: 3px; font-size: 11px; font-weight: 500; color: var(--blue-h); }
.cal .d.busy { background: rgba(0, 97, 255, .12); }
.cal .h { font-size: 11px; color: var(--muted-2); text-align: center; padding-bottom: 4px; }
.log .item { grid-template-columns: 1fr; }

/* offline / pending banner */
.offline { position: fixed; top: calc(var(--nav-h) + 8px); left: 50%; transform: translateX(-50%); z-index: 40; background: var(--amber); color: #000; font-size: 13px; font-weight: 500; padding: 8px 12px; border-radius: var(--r-btn); display: none; gap: 10px; align-items: center; max-width: calc(100vw - 32px); }
.offline.show { display: flex; }
.offline button { border: 0; background: rgba(0, 0, 0, .15); color: #000; font-weight: 500; padding: 4px 10px; border-radius: 3px; cursor: pointer; }
