* { box-sizing: border-box; }
:root {
  --main: #0f766e; --main-dark: #115e59; --bg: #f1f5f4; --card: #fff;
  --text: #1f2937; --muted: #6b7280; --line: #e5e7eb; --good: #15803d; --bad: #b91c1c;
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, label, input, select { touch-action: manipulation; -webkit-tap-highlight-color: rgba(15,118,110,.15); }
input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-cancel-button { display: none; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: 16px; line-height: 1.5; }
body { padding-bottom: env(safe-area-inset-bottom); }
.hidden { display: none !important; }
header { position: sticky; top: 0; z-index: 5; background: var(--main); color: #fff;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 0; }
header h1 { margin: 0 0 6px; font-size: 18px; }
nav { display: flex; gap: 4px; }
.tab { flex: 1; background: transparent; color: #d1fae5; border: 0; border-bottom: 3px solid transparent;
  padding: 8px 0; font-size: 15px; border-radius: 0; }
.tab.active { color: #fff; border-bottom-color: #fff; font-weight: bold; }
.screen { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto;
  padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
.offline { background: #7f1d1d; color: #fff; text-align: center; font-size: 13px; padding: 6px; }
.verdict { margin: 8px 0; padding: 10px; border-radius: 8px; font-weight: bold; text-align: center; }
.verdict.ok { background: #dcfce7; color: var(--good); }
.verdict.mid { background: #fef9c3; color: #a16207; }
.verdict.ng { background: #fee2e2; color: var(--bad); }
.prodcard.selected { outline: 3px solid var(--main); }
.shot input:disabled + span { opacity: .6; }
.grow { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 6px; }
.noimg { width: 52px; height: 52px; border-radius: 6px; background: #e5e7eb; flex-shrink: 0; }
#calc .row { margin-top: 8px; }
#calc .row .wide { flex: 1; padding: 12px 6px; font-size: 15px; }
.card { background: var(--card); border-radius: 12px; padding: 14px; margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.card.warn { background: #fef3c7; }
.card h2 { font-size: 16px; margin: 0 0 10px; }
.center { text-align: center; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
input, select { width: 100%; font-size: 16px; padding: 10px; border: 1px solid var(--line);
  border-radius: 8px; margin-top: 4px; background: #fff; color: var(--text); }
button { font-size: 15px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; }
button.primary { background: var(--main); color: #fff; border-color: var(--main); }
button.primary:active { background: var(--main-dark); }
button.danger { color: var(--bad); }
button.wide { width: 100%; padding: 14px; font-size: 16px; }
.small-btn { padding: 4px 10px; font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { margin-top: 0; }
.row.between { justify-content: space-between; }
.row.between h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.error { color: var(--bad); }
.shot { display: block; margin: 0; }
.shot input { display: none; }
.shot span { display: block; text-align: center; background: var(--main); color: #fff;
  padding: 18px; border-radius: 10px; font-size: 18px; font-weight: bold; }
#preview { width: 100%; max-height: 260px; object-fit: contain; margin-top: 10px; border-radius: 8px; background: #000; }
.status { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; background: #e0f2fe; font-size: 14px; }
.status.err { background: #fee2e2; color: var(--bad); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid #0369a1; border-right-color: transparent;
  border-radius: 50%; animation: s 0.8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes s { to { transform: rotate(360deg); } }
.prod { display: flex; gap: 10px; }
.prod img { width: 72px; height: 72px; object-fit: contain; flex-shrink: 0; background: #fafafa; border-radius: 6px; }
.prod .title { font-size: 14px; font-weight: bold; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.stat { background: #f8fafc; border-radius: 8px; padding: 6px; text-align: center; }
.stat b { display: block; font-size: 16px; }
.stat span { font-size: 11px; color: var(--muted); }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; font-weight: bold; }
.b-hot { background: #dcfce7; color: var(--good); }
.b-mid { background: #fef9c3; color: #a16207; }
.b-low { background: #fee2e2; color: var(--bad); }
.prod-actions { display: flex; gap: 6px; margin-top: 8px; }
.prod-actions button, .prod-actions a { font-size: 13px; padding: 6px 10px; }
a.btn { display: inline-block; border: 1px solid var(--line); border-radius: 8px; color: var(--text);
  text-decoration: none; background: #fff; white-space: nowrap; }
button:disabled { opacity: .5; }
.linkgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.linkgrid a { display: block; text-align: center; padding: 12px 6px; border-radius: 8px; background: #f0fdfa;
  color: var(--main-dark); text-decoration: none; font-weight: bold; font-size: 14px; border: 1px solid #99f6e4; }
table.profit { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 6px; }
table.profit th, table.profit td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; }
table.profit td:first-child, table.profit th:first-child { text-align: left; }
.plus { color: var(--good); font-weight: bold; }
.minus { color: var(--bad); font-weight: bold; }
.hist { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.hist img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.hist .t { font-size: 14px; font-weight: bold; }
.hist .meta { font-size: 12px; color: var(--muted); }
.hist .col { margin-left: auto; align-self: center; }
