:root {
  --bg: #f3eee6;
  --bg2: #e7dfd4;
  --card: #fffdf9;
  --card2: #2a211c;
  --line: #e4d9cc;
  --text: #2a211c;
  --muted: #6f6258;
  --accent: #d85a12;
  --accent2: #b4480e;
  --ok: #1f8a5b;
  --warn: #b78112;
  --bad: #c44732;
  --pin: #c49212;
  --radius: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; height: 100dvh; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100%; min-height: 100dvh; }

.app {
  min-height: 100%;
  min-height: 100dvh;
  padding-bottom: calc(118px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
.hidden { display: none !important; }

.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(243, 238, 230, .92);
  backdrop-filter: blur(16px);
  padding: max(18px, env(safe-area-inset-top)) 20px 8px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 0;
}
.top h1 { font-size: 20px; font-weight: 750; letter-spacing: -.02em; flex: 1; }
.top .sub { font-size: 13px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.back, .icon-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  width: 40px; height: 40px; border-radius: 12px; font-size: 20px; cursor: pointer;
}
.icon-btn.wide { width: auto; padding: 0 10px; font-size: 13px; }

.swipe-pane { min-height: 100%; min-height: 100dvh; touch-action: pan-y; }
.page { padding: 8px 20px 32px; }
.page.from-right { animation: tabInRight 320ms cubic-bezier(.22, 1, .36, 1); }
.page.from-left { animation: tabInLeft 320ms cubic-bezier(.22, 1, .36, 1); }
.page.fade { animation: tabFade 200ms ease; }
@keyframes tabInRight {
  from { transform: translateX(18%); opacity: .6; }
  to { transform: none; opacity: 1; }
}
@keyframes tabInLeft {
  from { transform: translateX(-18%); opacity: .6; }
  to { transform: none; opacity: 1; }
}
@keyframes tabFade {
  from { opacity: .35; }
  to { opacity: 1; }
}
.tab-stage { position: relative; overflow: hidden; height: 100dvh; }
html.tab-sliding, html.tab-sliding body { overflow: hidden; }
html.tab-sliding .tab-stage .swipe-pane {
  position: absolute; left: 0; right: 0; top: 0; bottom: 0;
  overflow: hidden; background: var(--bg);
  transition: transform 340ms cubic-bezier(.22, 1, .36, 1);
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  .page.from-right, .page.from-left, .page.fade { animation: none; }
  html.tab-sliding .tab-stage .swipe-pane { transition: none; }
}
.muted { color: var(--muted); font-size: 15px; line-height: 1.45; }
.row { display: flex; gap: 8px; align-items: center; }
.space { justify-content: space-between; }

.hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 6px 0 16px;
}
.hero-name { font-size: 28px; font-weight: 750; letter-spacing: -.03em; }
.role-chip {
  display: inline-block; font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
  background: #fff1e6; color: var(--accent2);
  padding: 6px 10px; border-radius: 999px; font-weight: 700;
}

.counts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 0 0 8px; }
.count {
  background: var(--card); border: 0; border-radius: 22px;
  box-shadow: 0 8px 22px rgba(42, 33, 28, .06);
  padding: 18px 8px 16px; text-align: center; cursor: pointer;
}
.count b { display: block; font-size: 32px; letter-spacing: -.04em; }
.count span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.count.bad b { color: var(--bad); }
.count.warn b { color: var(--warn); }
.count.ok b { color: var(--ok); }

.section-label {
  font-size: 13px; font-weight: 700; letter-spacing: .04em;
  color: var(--muted); margin: 22px 0 10px; text-transform: uppercase;
}
.section-label.fold {
  cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; background: none; border: 0; padding: 0; color: var(--muted);
}
.section-label.fold .chev { color: var(--accent); font-size: 12px; font-weight: 700; }
.sec-tools { display: flex; align-items: center; gap: 6px; }
.grip {
  color: var(--accent); font-size: 18px; padding: 2px 8px 2px 0;
  cursor: grab; touch-action: none; user-select: none;
}
.home-sec.dragging { opacity: .55; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.swatch {
  width: 26px; height: 26px; border-radius: 999px; border: 2px solid transparent;
  padding: 0; cursor: pointer;
}
.swatch.on { border-color: var(--text); }
.g-ico { display: inline-block; vertical-align: -4px; margin-right: 4px; }
.icon-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.icon-pick button {
  width: 42px; height: 42px; border-radius: 12px; border: 2px solid transparent;
  background: #f3eee6; color: #2a211c; padding: 0; cursor: pointer;
}
.icon-pick button.on { border-color: var(--accent); color: var(--accent); }

.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  background: var(--card); border: 0; border-radius: 22px;
  box-shadow: 0 8px 22px rgba(42, 33, 28, .06);
  padding: 18px 16px; cursor: pointer; min-height: 88px;
}
.tile h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.tile p { font-size: 13px; color: var(--muted); }

.card {
  background: var(--card); border: 0; border-radius: 22px;
  box-shadow: 0 8px 22px rgba(42, 33, 28, .06);
  padding: 18px; margin-bottom: 12px; cursor: pointer;
}
.card h3 { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.card .meta { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.who { color: #c44732; font-weight: 750; }
.status {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 5px 8px; border-radius: 999px; display: inline-block;
}
.status.ready { background: #e5f6ee; color: #146b44; }
.status.oos { background: #fde8e4; color: #9d3222; }
.status.due { background: #fff4dc; color: #8a6410; }
.status.open { background: #fff1e6; color: #a34410; }
.status.done { background: #e5f6ee; color: #146b44; }
.status.high { background: #fde8e4; color: #9d3222; }

.search {
  width: 100%; background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 14px; padding: 14px; font-size: 16px; margin-bottom: 12px;
}
label.field { display: block; font-size: 13px; font-weight: 650; color: var(--muted); margin: 16px 0 6px; }
input[type=text], input[type=password], input[type=number], input[type=file], input[type=date], select, textarea {
  width: 100%; background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 14px; padding: 14px; font-size: 16px;
}
textarea { min-height: 90px; resize: vertical; }
.btn {
  display: block; width: 100%; border: 0; border-radius: 14px; padding: 15px;
  font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 12px;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.good { background: var(--ok); color: #fff; }
.btn.bad { background: var(--bad); color: #fff; }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.sheet-back {
  position: fixed; inset: 0; z-index: 60; background: rgba(42, 33, 28, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: min(520px, 100%); max-height: 82vh; overflow: auto;
  background: var(--bg); border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px rgba(42, 33, 28, .18);
}
.btn.sm { display: inline-block; width: auto; padding: 8px 12px; font-size: 13px; margin: 0; }

.brand {
  font-size: 12px; font-weight: 700; letter-spacing: .16em; color: var(--accent);
  margin-bottom: 10px;
}
.mark {
  width: 100%; max-width: 420px; height: auto; margin: 0 auto 16px; border-radius: 18px;
  display: block; object-fit: contain;
}
.mark-sm {
  width: 28px; height: 28px; flex: 0 0 28px;
}
.login-wrap { padding: max(16px, env(safe-area-inset-top)) 22px 24px; overflow: visible; }
.login-wrap .mark { width: auto; max-width: 180px; max-height: 72px; object-fit: contain; margin: 0 auto 8px; }
html.pin-lock, html.pin-lock body { overflow: hidden; height: 100%; height: 100dvh; }
html.pin-lock .login-wrap {
  height: 100dvh; max-height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.pad button { touch-action: manipulation; }
.login-wrap h1 { font-size: 32px; letter-spacing: -.03em; margin-bottom: 8px; }
.user-pick {
  background: var(--card); border: 0; border-radius: 22px;
  box-shadow: 0 8px 22px rgba(42, 33, 28, .06);
  padding: 18px; margin: 12px 0; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
}
.user-pick b { font-size: 17px; }
.user-pick span { color: var(--muted); }
.hint {
  background: #fff1e6; color: #8a3d10;
  border-radius: 12px; padding: 12px; font-size: 14px; margin: 12px 0 8px;
}
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 22px 0 8px; }
.pin-dots span {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--accent); background: transparent;
}
.pin-dots span.on { background: var(--accent); }
.pad { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 16px; }
.pad button {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 16px; padding: 18px 0; font-size: 22px; font-weight: 700; cursor: pointer;
}
.err { color: var(--bad); font-size: 15px; text-align: center; min-height: 22px; margin-top: 8px; }

.check-item {
  background: var(--card); border: 0; border-radius: 22px;
  box-shadow: 0 8px 22px rgba(42, 33, 28, .06);
  padding: 16px; margin-bottom: 12px;
}
.check-item .q { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.days { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.day-btn {
  background: var(--bg2); border: 0; color: var(--muted);
  border-radius: 999px; padding: 8px 10px; font-weight: 700; cursor: pointer;
}
.day-btn.on { background: var(--accent); color: #fff; }
.seg { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.seg button {
  background: var(--bg2); border: 0; color: var(--muted);
  border-radius: 12px; padding: 12px; font-weight: 700; cursor: pointer;
}
.seg button.on.pass { background: #d9f3e6; color: #146b44; }
.seg button.on.fail { background: #fde8e4; color: #9d3222; }
.seg button.on.na { background: #2a211c; color: #fff; }
.tools-box {
  background: var(--card); border-radius: 22px; margin-bottom: 12px; overflow: hidden;
  box-shadow: 0 8px 22px rgba(42, 33, 28, .06);
}
.tools-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: transparent; border: 0; padding: 16px; text-align: left; cursor: pointer; font: inherit; color: inherit;
}
.tools-head span:first-child { flex: 1; }
.tools-head b { display: block; font-size: 16px; }
.tools-head small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.tool-count { border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 800; background: var(--bg2); color: var(--muted); white-space: nowrap; }
.tool-count.miss { background: #fde8e4; color: #9d3222; }
.tool-count.ok { background: #d9f3e6; color: #146b44; }
.tools-head .chev { color: var(--muted); font-size: 18px; }
.tool-list { border-top: 0; padding: 0 0 8px; }
.tool-list.open { background: var(--card); border-radius: 16px; padding: 4px 10px 8px; margin-bottom: 12px; }
.tool-row { display: flex; align-items: center; gap: 8px; padding: 4px 2px; }
.tool-row b { flex: 1; font-size: 13px; font-weight: 650; }
.tool-row button {
  border: 0; background: var(--bg2); color: var(--muted); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.tool-rec { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tool-chip { font-size: 12px; line-height: 1.2; padding: 4px 8px; border-radius: 999px; background: #efe8df; color: #5c5148; }
.tool-chip.miss { background: #fde8e4; color: #9d3222; }
.tool-row button.on.have { background: #d9f3e6; color: #146b44; }
.tool-row button.on.miss { background: #fde8e4; color: #9d3222; }
.tool-note { color: var(--muted); font-size: 13px; padding: 4px 8px 8px; }
.tool-edit {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--card); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px;
}

.nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: calc(100% - 28px); max-width: 440px;
  background: rgba(255, 253, 249, .96);
  border: 0; border-radius: 28px;
  box-shadow: 0 10px 28px rgba(42, 33, 28, .14);
  backdrop-filter: blur(16px);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 4px;
  z-index: 30;
}
.nav button {
  position: relative;
  background: none; border: 0; color: var(--muted); font-size: 11px;
  padding: 6px 2px; cursor: pointer; font-weight: 650;
  transition: color 160ms ease;
}
.nav button.on { color: var(--accent); }
.nav b { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin: 0 auto 3px; transition: transform 220ms cubic-bezier(.22, 1, .36, 1); }
.nav button.on b { transform: scale(1.12); }
.nav svg { display: block; width: 24px; height: 24px; }
.nav-dot {
  position: absolute; top: 0; right: 8px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 99px; background: #c45212; color: #fff;
  font-size: 10px; font-style: normal; font-weight: 800; line-height: 16px;
}
.alert {
  display: flex; gap: 10px; align-items: center;
  background: var(--card); border-radius: 18px; padding: 12px 12px 12px 14px;
  margin: 0 0 10px; box-shadow: 0 8px 22px rgba(42, 33, 28, .06);
  border-left: 4px solid #c45212;
}
.alert.done { border-left-color: #1f8a4c; }
.alert div { flex: 1; cursor: pointer; }
.alert b { display: block; font-size: 13px; }
.alert p { margin: 2px 0 0; font-size: 14px; }
.alert button {
  background: var(--bg2); border: 0; border-radius: 999px;
  padding: 8px 12px; font-weight: 700; cursor: pointer;
}

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  background: var(--card2); color: #fffdf9;
  padding: 12px 16px; border-radius: 12px; font-size: 14px;
  z-index: 50; max-width: 90%;
}

#print-sheet { display: none; }
#print-sheet h1 { font-size: 22px; margin: 0 0 4px; }
#print-sheet .sub { color: #5c5148; margin: 0 0 8px; }
#print-sheet h2 { font-size: 15px; margin: 22px 0 8px; border-bottom: 2px solid #e86a1a; padding-bottom: 4px; }
#print-sheet .block { border: 1px solid #e4d9cc; border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; }
#print-sheet h3 { margin: 0 0 4px; font-size: 16px; }
#print-sheet .pass { color: #146b44; font-weight: 700; }
#print-sheet .fail { color: #9d3222; font-weight: 700; }
#print-sheet .meta, #print-sheet .empty { color: #5c5148; font-size: 13px; }
@media print {
  #app, .toast, .nav { display: none !important; }
  #print-sheet {
    display: block !important;
    position: static;
    padding: 12px;
    background: #fff;
    color: #1c1612;
  }
}

.pin { color: var(--pin); font-size: 16px; margin-left: 6px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.photo-preview { max-width: 100%; border-radius: 12px; margin-top: 8px; }
.timeline { border-left: 2px solid var(--line); margin: 8px 0 0 8px; padding-left: 12px; }
.timeline div { margin-bottom: 10px; font-size: 14px; }
.danger-banner {
  background: #fde8e4; color: #9d3222; border-radius: 14px; padding: 12px 14px;
  font-size: 14px; margin-bottom: 12px;
}
