/* 物販リサーチ：白と濃紺。利益は緑、仕入れ上限は青。 */
:root {
  --bg: #F3F4F7; --card: #FFFFFF; --line: #E2E5EC; --line2: #EEF0F4;
  --ink: #161A23; --sub: #5B6272; --accent: #3346A8; --accent-soft: #E8EBF8;
  --gain: #18794E; --gain-soft: #E3F3EA; --warn: #8A4B00; --warn-soft: #FBEFD9; --bad: #B42318; --bad-soft: #FDECEA;
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --num: "Manrope", "Zen Kaku Gothic New", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
#app { max-width: 720px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
h1 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: .01em; text-wrap: balance; }
h2 { margin: 0; font-size: 15px; font-weight: 700; }
.eyebrow { font-size: 12px; color: var(--sub); letter-spacing: .04em; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.stat { border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--line); }
.stat.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.stat .k { font-size: 11px; color: var(--sub); } .stat.dark .k { color: #C9CEDA; }
.stat .v { font-family: var(--num); font-size: 22px; font-weight: 800; }
.kv { display: flex; flex-direction: column; } .kv .k { font-size: 11px; color: var(--sub); } .kv .v { font-family: var(--num); font-size: 15px; font-weight: 700; }
.gain { color: var(--gain); } .blue { color: var(--accent); } .bad { color: var(--bad); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 13px; white-space: nowrap; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--line2); color: var(--sub); white-space: nowrap; }
.pill.gain { background: var(--gain-soft); color: var(--gain); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.blue { background: var(--accent-soft); color: var(--accent); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
.notice { border-radius: 12px; padding: 10px 12px; font-size: 13px; background: var(--warn-soft); color: var(--warn); }
.notice.blue { background: var(--accent-soft); color: var(--accent); }

.cand { padding: 0; gap: 0; overflow: hidden; }
.cand .top { display: flex; gap: 12px; padding: 14px 14px 10px; color: var(--ink); }
.thumb { width: 64px; height: 64px; flex: none; border-radius: 12px; background: var(--accent-soft) center/cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--accent); text-align: center; overflow: hidden; }
.cand .name { font-size: 15px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.cand .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.cand .nums { padding: 0 14px 12px; }
.cand .acts { display: flex; gap: 8px; padding: 10px 14px 14px; border-top: 1px solid var(--line2); }

.btn { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; color: var(--ink); text-align: center; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.soft { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.icon { width: 44px; padding: 0; flex: none; }
.btn[disabled] { opacity: .5; cursor: default; }
.grow { flex: 1; min-width: 0; }

.rows { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--sub); }
.row b { font-family: var(--num); color: var(--ink); white-space: nowrap; }
.total { background: var(--ink); color: #fff; border-radius: 14px; padding: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.total .k { font-size: 11px; color: #C9CEDA; } .total .v { font-family: var(--num); font-size: 28px; font-weight: 800; }
.total .side { font-size: 12px; color: #C9CEDA; text-align: right; }

.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; text-align: left; width: 100%; }
.switch[aria-checked="true"] { background: var(--accent-soft); }
.switch .track { width: 46px; height: 28px; border-radius: 999px; background: #C9CEDA; padding: 3px; display: flex; flex: none; transition: background .15s; }
.switch[aria-checked="true"] .track { background: var(--accent); justify-content: flex-end; }
.switch .knob { width: 22px; height: 22px; border-radius: 50%; background: #fff; }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 72px; border-bottom: 1px solid var(--line); }
.bars div { flex: 1; border-radius: 4px 4px 0 0; background: #C8CEEA; min-height: 2px; }
.bars div.hi { background: var(--accent); }
.axis { display: flex; justify-content: space-between; font-family: var(--num); font-size: 11px; color: var(--sub); }

.link-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); color: var(--ink); }
.link-row span:first-child { font-weight: 700; font-size: 14px; }
.link-row .note { font-size: 12px; font-weight: 700; color: var(--sub); text-align: right; }
.sites { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.site { display: flex; flex-direction: column; justify-content: center; gap: 1px; min-height: 52px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); min-width: 0; }
.site .sn { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site .sp { font-size: 12px; color: var(--sub); font-family: var(--num); font-weight: 700; display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.site .sp small { font-family: var(--font); font-size: 10px; font-weight: 700; color: var(--warn); }
.site.ok { background: var(--gain-soft); border-color: var(--gain-soft); } .site.ok .sp { color: var(--gain); font-size: 14px; }
.site.over .sp { color: var(--ink); font-size: 14px; }
.site.muted .sp { font-family: var(--font); font-weight: 500; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5; min-height: 32px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }

label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--sub); min-width: 0; }
.field input, .field select, .field textarea { height: 48px; border-radius: 12px; border: 1px solid var(--line); padding: 0 14px; background: var(--card); font-size: 16px; color: var(--ink); width: 100%; min-width: 0; }
.field textarea { height: 96px; padding: 10px 14px; resize: vertical; }
.field input.big { font-family: var(--num); font-size: 18px; font-weight: 700; }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.step { height: 64px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.step b { font-family: var(--num); font-size: 20px; font-weight: 800; }
.step span { font-size: 11px; font-weight: 700; }
.step[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--sub); font-size: 12px; font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
td.n, th.n { text-align: right; font-family: var(--num); font-variant-numeric: tabular-nums; }

#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
#tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 6px; min-height: 48px; font-size: 11px; font-weight: 700; color: var(--sub); }
#tabs a[aria-current="page"] { color: var(--accent); }
#tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 700; z-index: 10; max-width: calc(100% - 32px); }
.empty { text-align: center; color: var(--sub); padding: 36px 16px; font-size: 14px; }
.login { max-width: 380px; margin: 12vh auto 0; }
@media (min-width: 960px) { #app { max-width: 1080px; } .wide-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; align-items: start; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
