:root {
  --ink: #111;
  --muted: #8e8e93;
  --tint: #1d4a3a;
  --bg: #f2f2f7;
  --card: #fff;
  --line: rgba(60,60,67,.12);
  --bad: #c41c1c;
  --ok: #1d4a3a;
  --wait: #9a7b12;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tab-h: 52px;
  --nav-h: 56px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100dvh;
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
  overscroll-behavior: none;
}
a { color: var(--tint); text-decoration: none; }
button { font: inherit; }

.app { max-width: 430px; margin: 0 auto; min-height: 100dvh; background: var(--bg); position: relative; }
@media (min-width: 768px) {
  body { background: #dcdce2; }
  .app { max-width: 430px; min-height: 100dvh; box-shadow: 0 0 0 1px var(--line), 0 18px 50px rgba(0,0,0,.12); }
  .app-wide { max-width: 740px; }
  .app-wide .wizbar { max-width: 740px; }
}

.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: var(--nav-h);
  padding: calc(8px + var(--safe-t)) 8px 8px;
  background: rgba(242,242,247,.86);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--line);
}
.nav-title { font-weight: 600; font-size: 17px; text-align: center; flex: 1; }
.nav-btn {
  min-width: 72px; min-height: 44px; display: inline-flex; align-items: center;
  padding: 0 10px; color: var(--tint); font-weight: 500; background: none; border: 0;
}
.nav-btn.right { justify-content: flex-end; }
#wiz-cap { font-size: 13px; font-weight: 600; max-width: 42%; line-height: 1.15; white-space: normal; text-align: right; }
.nav-btn.strong { font-weight: 600; }

.page { padding: 8px 16px 120px; }
.login-page { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px calc(32px + var(--safe-b)); }
.brand { text-align: center; margin-bottom: 28px; }
.brand .mark {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 16px;
  background: var(--tint); color: #fff; display: grid; place-items: center;
  font: 700 22px/1 -apple-system, sans-serif;
}
.brand h1 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 6px; }
.brand p { margin: 0; color: var(--muted); font-size: 15px; }

.group {
  background: var(--card); border-radius: 12px; overflow: hidden; margin: 12px 0;
}
.group label {
  display: block; padding: 11px 16px; margin: 0;
  border-bottom: .5px solid var(--line); font-size: 13px; color: var(--muted);
}
.group label:last-child { border-bottom: 0; }
.group input, .group textarea {
  display: block; width: 100%; margin: 6px 0 0; padding: 0;
  border: 0; background: transparent; font: 17px/1.35 -apple-system, sans-serif;
  outline: none; resize: vertical;
}
.pin-box { background: var(--card); border-radius: 12px; padding: 4px 16px; margin: 0 0 16px; }
.pin-box input {
  width: 100%; border: 0; background: transparent; padding: 14px 0;
  font: 22px/1.2 -apple-system, sans-serif; letter-spacing: .2em; text-align: center; outline: none;
}

.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 50px; border: 0; border-radius: 12px;
  background: var(--tint); color: #fff; font-weight: 600; font-size: 17px;
}
.btn:disabled { opacity: .4; }
.btn.ghost {
  background: transparent; color: var(--tint);
}
.btn.wide { width: auto; padding: 0 18px; min-width: 108px; }
.hide { display: none !important; }

.large-title { font-size: 34px; font-weight: 700; letter-spacing: -.03em; margin: 8px 4px 16px; }

.swipe {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  margin: 10px 0;
  background: var(--bad);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.swipe.fresh { box-shadow: inset 0 0 0 2px var(--tint); }
.swipe-del {
  position: absolute; inset: 0 0 0 auto; width: 96px; margin: 0;
  display: flex;
}
.swipe-del button {
  flex: 1; border: 0; background: transparent; color: #fff;
  font-weight: 600; font-size: 15px;
}
.cell {
  background: var(--card); border-radius: 12px; padding: 14px 36px 14px 16px;
  margin: 10px 0; color: inherit; display: block;
}
.swipe .cell {
  margin: 0; border-radius: 0; position: relative; z-index: 1;
  will-change: transform;
}
.cell .row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.cell strong { font-size: 17px; }
.cell .fine { margin: 4px 0 0; }
.swipe.open .swipe-front::after { opacity: 0; }

.tag { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.tag.wait { background: #fff4cc; color: var(--wait); }
.tag.ok { background: #e4f3ec; color: var(--ok); }
.tag.silent { background: #fde8e8; color: var(--bad); }
.fine { color: var(--muted); font-size: 13px; }
.banner { background: #e4f3ec; color: var(--ok); padding: 12px 14px; border-radius: 12px; font-size: 15px; }
.banner.bad { background: #fde8e8; color: var(--bad); }

.tabbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  display: flex; justify-content: space-around;
  padding: 4px 8px var(--safe-b);
  min-height: calc(var(--tab-h) + var(--safe-b));
  background: rgba(249,249,249,.92);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--line); z-index: 30;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 48px; color: var(--muted); font-size: 10px; font-weight: 500;
}
.tab.on { color: var(--tint); }
.tab svg { width: 26px; height: 26px; }

.dots { display: flex; gap: 6px; justify-content: center; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #d1d1d6; display: block; }
.dots i.on { background: var(--tint); width: 18px; border-radius: 99px; }

.step-label { display: none; }
.sheet h2 { font-size: 22px; margin: 8px 0 12px; letter-spacing: -.02em; }
.hint { color: var(--muted); font-size: 15px; margin: 0 0 12px; }

.arch { background: var(--card); border-radius: 12px; padding: 12px; margin: 8px 0 16px; }
.arch-cap { font-size: 12px; color: var(--muted); margin: 8px 0 6px; }
.teeth { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.tooth {
  min-height: 40px; padding: 0; border-radius: 10px; border: 0;
  background: var(--bg); color: var(--ink); font: 600 14px/1 -apple-system, sans-serif;
}
.tooth.on { color: #c41c1c; background: #fff5f5; box-shadow: inset 0 0 0 1.5px #e24b4b; }
.tooth.pick { background: var(--tint); color: #fff; box-shadow: none; }
.job-rows { margin: 0 0 12px; }
.job-row {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--card); border-radius: 12px; padding: 10px 12px; margin: 8px 0;
}
.job-row b { min-width: 28px; color: #c41c1c; font-size: 15px; }
.job-row span { flex: 1; font-size: 15px; }
.job-row .x {
  border: 0; background: none; color: var(--muted); font-size: 20px;
  min-width: 32px; min-height: 32px; padding: 0;
}

.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shot {
  aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--card);
  position: relative;
}
.shot.add {
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed #c7c7cc; color: var(--tint); font-size: 40px; font-weight: 300;
}
.shot.add input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
.shot.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-x {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
  font-size: 18px; line-height: 1;
}
.shot.add.hide { display: none; }

.wizbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px calc(10px + var(--safe-b));
  background: rgba(249,249,249,.94);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--line); z-index: 30;
}
.lan { font: 13px/1.4 ui-monospace, Menlo, monospace; background: var(--card); border-radius: 10px; padding: 10px 12px; word-break: break-all; color: var(--muted); }
.more { margin-top: 20px; }
.more summary { color: var(--muted); font-size: 13px; cursor: pointer; }
@media (display-mode: standalone) {
  .more { display: none; }
}

.styles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 18px;
}
.style-pick {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px; font-weight: 600; color: var(--ink);
  border: 2px solid transparent;
}
.style-pick.on { border-color: var(--tint); }
.style-pick input {
  position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer;
}
.swatch { height: 48px; border-radius: 8px; display: block; }
.swatch.pine { background: linear-gradient(90deg, #1d4a3a 34%, #f3f0e8 34%); }
.swatch.night { background: #101614; }
.swatch.paper { background: #f7f4ec; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.swatch.line { background: linear-gradient(90deg, #1d4a3a 8px, #f4f1ea 8px); }
