/* CageGuru: phone-first. One column, big tap targets, bottom nav on small screens. */
:root {
  --bg: #f4f5f7; --card: #ffffff; --ink: #1a1d23; --muted: #5f6672; --line: #dfe2e8;
  --brand: #16304d; --brand-ink: #ffffff; --accent: #f26a1b; --ok: #1f8f4e; --warn: #c23b22; --warn-bg: #fdecea;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); padding-bottom: 72px; }
a { color: var(--brand); }
header.top { background: var(--brand); color: var(--brand-ink); padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 5; }
header.top .logo { font-weight: 800; letter-spacing: .3px; color: #fff; text-decoration: none; font-size: 18px; }
header.top .logo b { color: var(--accent); }
header.top .site { font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.top form { margin: 0; }
main { max-width: 900px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 20px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.flash { background: #e7f6ec; border: 1px solid #b9e3c6; color: #145c32; padding: 10px 12px; border-radius: var(--radius); margin-bottom: 14px; }
.error { background: var(--warn-bg); border: 1px solid #f3c2ba; color: var(--warn); padding: 10px 12px; border-radius: var(--radius); margin-bottom: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
textarea { min-height: 80px; }
button, .btn { display: inline-block; font: inherit; font-weight: 600; padding: 12px 16px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; text-align: center; }
button.secondary, .btn.secondary { background: #fff; color: var(--brand); }
button.accent, .btn.accent { background: var(--accent); border-color: var(--accent); }
button.danger { background: #fff; color: var(--warn); border-color: var(--warn); }
button.small, .btn.small { padding: 8px 12px; font-size: 14px; }
button.block, .btn.block { display: block; width: 100%; margin-top: 12px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; }
.stat b { display: block; font-size: 26px; color: var(--brand); }
.stat span { font-size: 12px; color: var(--muted); }
.stat.warn b { color: var(--warn); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
.list li a.item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.list .title { font-weight: 700; }
.list .sub { font-size: 13px; color: var(--muted); }
.qty { font-size: 20px; font-weight: 800; color: var(--brand); min-width: 44px; text-align: right; }
.qty.low { color: var(--warn); }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #e8edf5; color: var(--brand); text-transform: uppercase; }
.pill.low { background: var(--warn-bg); color: var(--warn); }
.pill.done { background: #e7f6ec; color: var(--ok); }
.pill.high { background: var(--warn-bg); color: var(--warn); }
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search input { flex: 1; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.muted { color: var(--muted); font-size: 13px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.actions form { margin: 0; }
.actions button { width: 100%; }
nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: space-around; z-index: 5; padding-bottom: env(safe-area-inset-bottom); }
nav.bottom a { flex: 1; text-align: center; padding: 10px 4px 8px; font-size: 12px; color: var(--muted); text-decoration: none; }
nav.bottom a .ic { display: block; font-size: 20px; line-height: 22px; }
nav.bottom a.active { color: var(--brand); font-weight: 700; }
nav.bottom a.scan { color: var(--accent); font-weight: 700; }
nav.bottom a.scan .ic { background: var(--accent); color: #fff; border-radius: 50%; width: 52px; height: 52px; line-height: 52px; margin: -22px auto 2px; box-shadow: 0 4px 12px rgba(0,0,0,.25); font-size: 24px; }
/* scanner */
.viewfinder { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4/3; }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewfinder .frame { position: absolute; inset: 18% 10%; border: 2px solid rgba(255,255,255,.8); border-radius: 8px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); pointer-events: none; }
#result .big { font-size: 22px; font-weight: 800; }
.auth { max-width: 420px; margin: 24px auto; }
.auth .logo { font-size: 28px; font-weight: 800; color: var(--brand); text-align: center; margin: 10px 0 18px; }
.auth .logo b { color: var(--accent); }
/* labels */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.label { border: 1px dashed #bbb; padding: 6px; background: #fff; text-align: center; break-inside: avoid; }
.label .l1 { font-weight: 800; font-size: 15px; }
.label .l2 { font-size: 12px; } .label .l3 { font-size: 12px; color: #333; }
.label svg { max-width: 100%; height: auto; }
@media print { header.top, nav.bottom, .noprint { display: none !important; } body { background: #fff; padding: 0; } main { max-width: none; padding: 0; } .label { border-color: #eee; } }
.badge { position:absolute; top:-6px; right:-6px; background: var(--accent); color:#fff; font-size:11px; font-weight:800; border-radius:999px; min-width:18px; height:18px; line-height:18px; text-align:center; padding:0 4px; }
/* ---- Guru the mascot: levitating mechanic-monk with parts in orbit ---- */
.guru { display:inline-block; flex: 0 0 auto; }
.guru svg { width:100%; height:100%; overflow:visible; }
.guru .body { animation: guru-bob 3.6s ease-in-out infinite; }
.guru .shadow { transform-origin: 85px 166px; animation: guru-shadow 3.6s ease-in-out infinite; }
.guru .aura { transform-origin: 85px 104px; animation: guru-aura 3.6s ease-in-out infinite; }
.guru .tails { animation: guru-flutter 2.2s ease-in-out infinite; }
.guru .eye-peek { opacity: 0; animation: guru-peek 7s infinite; }
.guru .eyes-closed path:nth-child(2) { animation: guru-peek-hide 7s infinite; }
.guru .orbit { transform-origin: 85px 100px; animation: guru-orbit 16s linear infinite; }
.guru .unspin { animation: guru-orbit 16s linear infinite reverse; }
.guru .o1, .guru .u1 { animation-delay: 0s; }
.guru .o2, .guru .u2 { animation-delay: -4s; }
.guru .o3, .guru .u3 { animation-delay: -8s; }
.guru .o4, .guru .u4 { animation-delay: -12s; }
.guru-calm .orbit { display: none; }
@keyframes guru-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes guru-shadow { 0%,100% { transform: scaleX(1); opacity:.13; } 50% { transform: scaleX(.82); opacity:.08; } }
@keyframes guru-aura { 0%,100% { transform: scale(1); opacity:.07; } 50% { transform: scale(1.06); opacity:.12; } }
@keyframes guru-flutter { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-9deg); } }
@keyframes guru-peek { 0%,55%,62%,100% { opacity:0; } 57%,60% { opacity:1; } }
@keyframes guru-peek-hide { 0%,55%,62%,100% { opacity:1; } 57%,60% { opacity:0; } }
@keyframes guru-orbit { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .guru * { animation: none !important; } }
/* header width matches content on wide screens */
header.top { padding: 0; }
header.top .inner { max-width: 900px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* memo layout */
.memo-wrap { display:flex; gap:18px; align-items:flex-start; }
.memo-wrap .guru { margin-top: 6px; width: 150px !important; height: 160px !important; }
.bubble { position:relative; flex:1; background:#fff; border:1px solid var(--line); border-radius:16px; padding:18px 20px; box-shadow:0 6px 20px rgba(22,48,77,.08); }
.bubble:before { content:""; position:absolute; left:-10px; top:38px; border:10px solid transparent; border-right-color:var(--line); border-left:0; }
.bubble:after { content:""; position:absolute; left:-8px; top:39px; border:9px solid transparent; border-right-color:#fff; border-left:0; }
.bubble h1 { margin:0 0 6px; font-size:24px; }
.bubble .body { white-space:pre-wrap; font-size:17px; line-height:1.6; margin-top:12px; }
.from { display:flex; align-items:center; gap:10px; color:var(--muted); font-size:14px; }
.avatar { width:32px; height:32px; border-radius:50%; background:var(--accent); color:#fff; font-weight:800; display:inline-flex; align-items:center; justify-content:center; font-size:13px; }
.empty { display:flex; gap:16px; align-items:center; background:#fff; border:1px dashed var(--line); border-radius:16px; padding:18px; }
.empty p { margin:0; }
@media (max-width: 560px) { .memo-wrap { flex-direction:column; align-items:center; } .bubble:before,.bubble:after { left:50%; top:-10px; border:10px solid transparent; border-bottom-color:var(--line); border-top:0; margin-left:-10px; } .bubble:after { top:-8px; border:9px solid transparent; border-bottom-color:#fff; border-top:0; margin-left:-9px; } }
/* nav: same width as the page; SVG icons */
nav.bottom { display:block; }
nav.bottom .inner { max-width: 900px; margin: 0 auto; display:flex; justify-content:space-around; }
nav.bottom .inner a { flex:1; }
nav.bottom a .ic { display:flex; justify-content:center; align-items:center; height:24px; }
/* label card on part / equipment pages */
.labelcard-codes { display:flex; gap:18px; align-items:center; justify-content:space-between; flex-wrap:wrap; }
.labelcard-bar { flex:1 1 260px; text-align:center; }
.labelcard-bar svg { max-width:100%; height:auto; }
.labelcard-qr { flex:0 0 auto; text-align:center; }
.labelcard-qr svg { width:132px; height:132px; display:block; margin:0 auto; }
.labelcard .muted { font-size:12px; margin-top:4px; }
.label-row { display:flex; align-items:center; justify-content:center; gap:6px; }
.label-row > svg { max-width:72%; height:auto; }
.label-qr svg { width:56px; height:56px; display:block; }
.memo-h { display:block; color: var(--brand); font-size: 15px; letter-spacing:.2px; margin-top: 6px; }
/* ---- Guru's tour ---- */
.tour-root { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.tour-dim, .tour-block { position: fixed; inset: 0; pointer-events: auto; }
.tour-dim { background: rgba(10, 22, 38, .62); }
.tour-block { background: transparent; }
.tour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(10, 22, 38, .62); pointer-events: none;
             outline: 3px solid var(--accent); outline-offset: 0; transition: all .25s ease; }
.tour-spot.tap { animation: tour-pulse 1.4s ease-in-out infinite; }
@keyframes tour-pulse { 0%,100% { outline-color: var(--accent); } 50% { outline-color: #ffd2b5; } }
.tour-card { position: fixed; pointer-events: auto; background: #fff; border-radius: 16px; padding: 16px;
             box-shadow: 0 18px 50px rgba(0,0,0,.35); color: var(--ink); max-width: calc(100vw - 24px); }
.tour-card.tour-modal { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100vw - 32px)); text-align: center; }
.tour-card.nudge { animation: tour-nudge .35s; }
@keyframes tour-nudge { 25% { margin-left: -6px; } 75% { margin-left: 6px; } }
.tour-head { display: flex; gap: 12px; align-items: center; }
.tour-modal .tour-head { flex-direction: column; }
.tour-guru .guru { width: 56px !important; height: 60px !important; }
.tour-modal .tour-guru .guru { width: 120px !important; height: 128px !important; }
.tour-title { font-weight: 800; font-size: 17px; }
.tour-modal .tour-title { font-size: 21px; }
.tour-count { font-size: 12px; color: var(--muted); }
.tour-text { margin: 10px 0 12px; line-height: 1.5; }
.tour-dots { display: flex; gap: 4px; margin-bottom: 12px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.tour-dots i.on { background: var(--accent); width: 16px; border-radius: 3px; }
.tour-btns { display: flex; gap: 8px; align-items: center; }
.tour-modal .tour-btns { flex-direction: column-reverse; }
.tour-modal .tour-btns button.accent { width: 100%; }
.tour-skip { white-space: nowrap; background: none; border: 0; color: var(--muted); font-weight: 500; padding: 8px 4px; text-decoration: underline; }
.tour-hint { font-size: 12px; text-align: right; font-weight: 700; color: var(--accent); }
.tour-chip { position: fixed; left: 50%; transform: translateX(-50%); bottom: 86px; pointer-events: auto; background: var(--brand);
             color: #fff; border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
@media (prefers-reduced-motion: reduce) { .tour-spot { transition: none; animation: none; } }
.billnote { display:block; padding:10px 12px; border-radius: var(--radius); margin-bottom:12px; text-decoration:none; font-size:14px; }
.billnote.trial { background:#eef3fb; color: var(--brand); border:1px solid #cfdcf0; }
.billnote.warn, .billnote.hold { background: var(--warn-bg); color: var(--warn); border:1px solid #f3c2ba; }
.plan-card h3 { font-size: 19px; }
nav.bottom a.locked { opacity: .55; }
nav.bottom a.locked::after { content: "Plant"; display:block; font-size:9px; font-weight:800; color: var(--accent); margin-top:-2px; }
