:root {
  --bg: #f3f3f3; --card: #fff; --ink: #1a1a1a; --ink2: #555; --ink3: #6b6b6b;
  --line: #e6e6e6; --dark: #1a1a1a; --dark2: #2e2e2e;
  --accent: #f25c00; --accent-ink: #c74a00; --accent-soft: #ffd9bf; --accent-on-dark: #ff6a00;
  --ok: #1f7a3d; --bad: #b3261e; --chip: #eee;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: #dedede; color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px; line-height: 1.35; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }

#shell { max-width: 560px; margin: 0 auto; min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; }
#top { background: var(--dark); color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; z-index: 20; min-height: 60px; }
#top .title { font-size: 19px; font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#top .title span { color: var(--accent-on-dark); }
#top .pill, #top .back { background: var(--dark2); color: #fff; border: 0; border-radius: 12px; min-height: 40px;
  padding: 0 12px; font-size: 13px; font-weight: 700; display: flex; align-items: center; white-space: nowrap; }
#app { flex: 1; padding: 14px 14px 110px; display: flex; flex-direction: column; gap: 12px; }
#nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; z-index: 30;
  background: #fff; border-top: 1px solid #e3e3e3; display: flex; padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
#nav a { flex: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 11px; font-weight: 600; color: var(--ink3); position: relative; }
#nav a.on { color: var(--accent-ink); font-weight: 700; }
#nav svg { width: 22px; height: 22px; }
.badge { position: absolute; top: 2px; left: 54%; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800;
  min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

.card { background: var(--card); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card.dark { background: var(--dark); color: #fff; }
.card.dark .muted { color: #d6d6d6; }
.card h2 { font-size: 16px; font-weight: 800; }
a.card, button.card { border: 0; text-align: left; width: 100%; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--card); border-radius: 20px; padding: 14px 16px; }
.stat b { display: block; font-size: 21px; font-weight: 800; letter-spacing: -0.3px; }
.stat span { display: block; font-size: 13px; color: var(--ink3); margin-top: 3px; }
.stat.hot { background: var(--accent); }
.grid3 .stat { padding: 12px; }
.grid3 .stat b, .grid3 .stat.hot b { font-size: 16px; letter-spacing: -0.4px; white-space: nowrap; }
.grid3 .stat span { font-size: 12px; }
.stat.hot b { color: #fff; font-size: 24px; }
.stat.hot span { color: var(--ink); font-weight: 600; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.row.mid { align-items: center; }
.rows > * + * { border-top: 1px solid var(--line); padding-top: 10px; }
.rows { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--ink3); font-size: 13px; }
.small { font-size: 13px; }
.b { font-weight: 700; } .xb { font-weight: 800; }
.acc { color: var(--accent-ink); font-weight: 700; }
.card.dark .acc { color: var(--accent-on-dark); }
.nowrap { white-space: nowrap; }
.tag { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: var(--chip); white-space: nowrap; }
.tag.dark { background: var(--dark); color: #fff; }
.tag.warm { background: var(--accent-soft); }
.note { font-size: 12px; color: var(--ink3); padding: 0 6px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { min-height: 44px; padding: 0 14px; border: 0; border-radius: 14px; font-size: 14px; font-weight: 700;
  background: #fff; color: var(--ink2); white-space: nowrap; flex-shrink: 0; }
.card .chip { background: var(--chip); color: #444; }
.chip.on, .card .chip.on { background: var(--dark); color: #fff; }
.seg { display: flex; gap: 6px; background: #fff; border-radius: 16px; padding: 5px; }
.seg button { flex: 1; min-height: 44px; padding: 4px 6px; border: 0; border-radius: 12px; background: transparent; font-size: 14px; font-weight: 700; color: var(--ink2); }
.seg button.on { background: var(--dark); color: #fff; }

.btn { min-height: 50px; border: 0; border-radius: 16px; background: var(--dark); color: #fff; font-size: 16px; font-weight: 800;
  padding: 0 16px; display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.btn svg { width: 22px; height: 22px; flex-shrink: 0; }
.btn.hot { background: var(--accent); font-size: 18px; min-height: 56px; }
.btn.light { background: #fff; color: var(--ink); font-size: 14px; font-weight: 700; }
.card .btn.light { background: var(--chip); }
.btn.sm { min-height: 44px; font-size: 14px; font-weight: 700; border-radius: 12px; }
.btn.dash { background: transparent; border: 2px dashed #b5b5b5; color: var(--ink2); font-size: 14px; font-weight: 700; }
.btn.danger { background: #fff; color: var(--bad); box-shadow: inset 0 0 0 2px var(--bad); }
.btn:disabled { opacity: .45; }
.btns { display: flex; gap: 10px; }
.btns > * { flex: 1; }
.btns > .w2 { flex: 2; }

label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink3); min-width: 0; flex: 1; }
.in, label.f input, label.f select, label.f textarea { min-height: 46px; width: 100%; border: 2px solid #d0d0d0; border-radius: 12px;
  padding: 0 12px; font-size: 16px; color: var(--ink); background: #fff; outline: none; }
label.f textarea { padding: 10px 12px; min-height: 80px; resize: vertical; }
label.f input:focus, label.f select:focus, label.f textarea:focus, .in:focus { border-color: var(--accent); }
label.f input.hot { border-color: var(--accent); font-weight: 800; }
.fr { display: flex; gap: 10px; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-height: 48px; border: 0; border-radius: 14px; padding: 0 14px; font-size: 16px; background: #fff; outline: none; min-width: 0; }
.iconbtn { width: 48px; min-height: 48px; border: 0; border-radius: 14px; background: var(--dark); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.iconbtn svg { width: 22px; height: 22px; }
.xbtn { width: 44px; min-height: 44px; border: 0; border-radius: 12px; background: var(--chip); font-size: 20px; font-weight: 700; flex-shrink: 0; }
.check { width: 28px; height: 28px; border-radius: 9px; border: 2px solid #b5b5b5; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: #fff; }
.check.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.unitrow { display: flex; align-items: center; gap: 12px; min-height: 52px; width: 100%; border: 0; background: transparent; text-align: left; padding: 0; }
.empty { text-align: center; color: var(--ink3); padding: 28px 10px; font-size: 14px; }
.cartbar { position: fixed; bottom: calc(74px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: calc(100% - 28px);
  max-width: 532px; z-index: 25; background: var(--accent); color: #fff; border: 0; border-radius: 16px; min-height: 54px;
  font-size: 16px; font-weight: 800; box-shadow: 0 6px 20px rgba(0,0,0,.25); }

#modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55); display: none; align-items: flex-end; justify-content: center; }
#modal.on { display: flex; }
#modal .sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
#modal h2 { font-size: 18px; font-weight: 800; padding: 0 4px; }
#toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 90; background: var(--dark); color: #fff;
  padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 700; max-width: 92%; display: none; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
#toast.on { display: block; }
#toast.err { background: var(--bad); }

#scan { position: fixed; inset: 0; z-index: 70; background: #000; color: #fff; display: none; flex-direction: column; }
#scan.on { display: flex; }
#scan .shead { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#scan .shead b { font-size: 17px; }
#scan-view { flex: 1; min-height: 0; background: #111; overflow: hidden; position: relative; }
#scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#scan-guide { position: absolute; left: 4%; right: 4%; top: 50%; height: 24%; min-height: 110px; transform: translateY(-50%);
  border: 3px solid var(--accent-on-dark); border-radius: 16px; box-shadow: 0 0 0 2000px rgba(0,0,0,.45); pointer-events: none; }
#scan .sfoot { padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
#scan .sfoot .hint { font-size: 13px; color: #d6d6d6; }
#scan .last { font-size: 15px; font-weight: 800; color: var(--accent-on-dark); min-height: 20px; }
#scan .closebtn { background: var(--dark2); color: #fff; border: 0; border-radius: 12px; min-height: 44px; padding: 0 16px; font-weight: 700; }

.login { padding: 40px 6px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 26px; font-weight: 800; }
.login h1 span { color: var(--accent-ink); }
.spin { text-align: center; padding: 40px; color: var(--ink3); }

/* v1.1 */
.tags { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.tag.repair { background: var(--dark); color: var(--accent-on-dark); }
.card.repairbox { box-shadow: inset 0 0 0 2px var(--accent); }
.plus { color: var(--ok); }
label.f select { -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, #6b6b6b 50%), linear-gradient(135deg, #6b6b6b 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 12px) 20px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 30px; text-overflow: ellipsis; }
/* поля даты на iPhone не должны вылезать за край карточки */
input[type="datetime-local"], input[type="date"] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; font-size: 15px; }
.fr > label.f { min-width: 0; overflow: hidden; }
input[type="file"] { min-height: 46px; width: 100%; border: 2px dashed #b5b5b5; border-radius: 12px; background: #fff; font-size: 14px; }
#scan-confirm { display: flex; flex-direction: column; gap: 10px; }
#scan-confirm[hidden], #nav[hidden], .merr[hidden] { display: none; }
.scan-code { font-size: 26px; font-weight: 800; letter-spacing: 0.5px; color: #fff; word-break: break-all; }

/* v1.2 */
button.card.folder { cursor: pointer; }
.foldhead { font-size: 13px; font-weight: 800; color: var(--ink3); text-transform: uppercase; letter-spacing: 0.6px; padding: 6px 6px 0; }
.linkbtn { border: 0; background: transparent; padding: 6px 0 0 8px; font-size: 12px; font-weight: 700; color: var(--accent-ink); min-height: 30px; }
.linkbtn.bad { color: var(--bad); }
.card .rows b { font-weight: 800; }

.chips.crumbs { margin-bottom: 10px; }
span.chip { display: inline-flex; align-items: center; }
.merr { background: #fde8e6; color: var(--bad); font-weight: 700; border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.psq { width: 100%; min-height: 48px; border: 0; border-radius: 14px; padding: 0 14px; font-size: 16px; background: #fff; outline: none; }
.biglist { display: flex; flex-direction: column; gap: 12px; }

/* ---------- компьютер: меню слева, шире контент ---------- */
@media (min-width: 1000px) {
  html, body { background: var(--bg); }
  #shell { max-width: none; }
  #shell:has(#nav:not([hidden])) { padding-left: 232px; }
  #top { padding: 14px 28px; }
  #nav { top: 0; bottom: 0; left: 0; transform: none; width: 232px; max-width: none; flex-direction: column; gap: 4px;
    border-top: 0; border-right: 1px solid #e3e3e3; padding: 76px 12px 16px; }
  #nav a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 14px;
    border-radius: 14px; font-size: 15px; }
  #nav a:hover { background: var(--chip); }
  #nav a.on { background: var(--accent-soft); }
  #app { width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 28px 48px; gap: 16px; }
  #app > .grid2 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .biglist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .biglist > .foldhead, .biglist > .chips, .biglist > .empty, .biglist > .spin { grid-column: 1 / -1; }
  .cartbar { left: calc(50% + 116px); max-width: 600px; bottom: 24px; }
  #modal { align-items: center; }
  #modal .sheet { border-radius: 22px; max-height: 88vh; padding-bottom: 18px; }
  .login { max-width: 440px; margin: 40px auto 0; width: 100%; }
}
.denied { min-height: 70vh; display: flex; align-items: center; justify-content: center; color: var(--ink3); font-size: 15px; text-align: center; padding: 24px; }
.card.task { border-left: 6px solid #d6d6d6; }
.card.task.urgent { border-left-color: #d92d20; background: #fff4f3; }
.card.task.high { border-left-color: #f5b400; background: #fffbea; }
.tag.prio.urgent { background: #d92d20; color: #fff; }
.tag.prio.high { background: #f5b400; color: #1a1a1a; }
.btns.wrap { flex-wrap: wrap; }
.btns.wrap > * { flex: 1 1 calc(50% - 5px); }
.card.task .btns { flex-wrap: wrap; }
.card.task .btns > * { flex: 1 1 calc(50% - 5px); }
