/* グロースリンク 営業ダッシュボード。色は workspaces/growthlink/DESIGN.md（濃紺・ベージュ寄りの地・白いカード・罫線） */
:root {
  --navy: #043992; --navy-d: #013162; --blue: #1f5fb0; --canvas: #f6f5f0; --paper: #fff; --rule: #e3e1d8;
  --ink: #111; --sub: #5b5e66; --red: #b72402; --ok: #1e7b4f; --warn: #a15c00;
  --r: 10px; --tab-h: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif; font-size: 14px; line-height: 1.6; color: var(--ink); background: var(--canvas); }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* 上の帯と下のタブ */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--navy-d); color: #fff; }
.topbar h1 { font-size: 15px; margin: 0; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .who { font-size: 12px; opacity: .85; max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 0; color: inherit; padding: 6px; cursor: pointer; display: inline-flex; border-radius: 6px; }
.icon-btn svg { width: 20px; height: 20px; }
main#view { padding: 16px 12px calc(var(--tab-h) + 24px); max-width: 960px; margin: 0 auto; }
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; height: var(--tab-h); background: var(--paper); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom); }
nav.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--sub); font-size: 11px; }
nav.tabs a svg { width: 22px; height: 22px; }
nav.tabs a.on { color: var(--navy); font-weight: 700; }

/* カード */
.card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 14px; margin: 0 0 10px; color: var(--navy); display: flex; align-items: center; gap: 6px; }
.card h2::before { content: ""; width: 14px; height: 2px; background: var(--red); display: inline-block; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--sub); font-size: 12px; }

/* 数字 */
.kgi-amount { font-size: 28px; font-weight: 800; color: var(--navy); letter-spacing: .01em; }
.kgi-amount small { font-size: 13px; font-weight: 600; color: var(--sub); margin-left: 6px; }
.rate { font-size: 22px; font-weight: 800; color: var(--navy); }
.bar { height: 10px; background: #e9e7de; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--navy); border-radius: 99px; width: 0; transition: width .4s; }
.bar.small { height: 6px; }
.funnel { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.funnel div { background: #f3f2ec; border-radius: 8px; padding: 8px 2px; }
.funnel b { display: block; font-size: 20px; color: var(--navy); }
.funnel span { font-size: 11px; color: var(--sub); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; }
.stat .label { font-size: 12px; color: var(--sub); }
.stat .val { font-size: 20px; font-weight: 800; color: var(--navy); }
.stat .val small { font-size: 12px; color: var(--sub); font-weight: 600; }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 8px 6px; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
table.list th:first-child, table.list td:first-child, table.list td.l, table.list th.l { text-align: left; }
table.list th { font-size: 12px; color: var(--sub); font-weight: 600; }
table.list tr.me td { background: #eef3fb; font-weight: 700; }
.rank { display: inline-block; width: 22px; color: var(--sub); }
.scroll-x { overflow-x: auto; }

/* 担当先 */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.chip { flex: none; border: 1px solid var(--rule); background: var(--paper); border-radius: 99px; padding: 5px 12px; cursor: pointer; color: var(--ink); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.acc { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--rule); text-decoration: none; color: inherit; }
.acc .name { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc .owner { font-size: 12px; color: var(--sub); }
.steps { display: flex; gap: 3px; flex: none; }
.steps i { width: 22px; height: 6px; border-radius: 3px; background: #e2e0d6; display: block; }
.steps i.on { background: var(--navy); }
.badge { font-size: 11px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--rule); color: var(--sub); flex: none; }
.badge.yes { color: var(--ok); border-color: var(--ok); }
.badge.no { color: var(--sub); }

/* フォーム */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; color: var(--sub); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=tel], select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #cfccc0; border-radius: 8px; background: #fff; color: var(--ink); min-height: 44px; }
textarea { min-height: 96px; resize: vertical; }
input:disabled, select:disabled, textarea:disabled { background: #f3f2ec; color: var(--sub); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.status-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.status-row label { display: flex; align-items: center; gap: 8px; flex: 1; font-weight: 600; min-height: 32px; }
.status-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--navy); }
.status-row input[type=date] { width: 150px; flex: none; min-height: 38px; padding: 6px 8px; }
.seg { display: flex; border: 1px solid #cfccc0; border-radius: 8px; overflow: hidden; }
.seg label { flex: 1; text-align: center; padding: 9px 4px; cursor: pointer; border-right: 1px solid #cfccc0; }
.seg label:last-child { border-right: 0; }
.seg input { display: none; }
.seg input:checked + span { color: #fff; }
.seg label:has(input:checked) { background: var(--navy); color: #fff; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--navy); background: #fff; color: var(--navy); border-radius: 8px; padding: 9px 16px; min-height: 42px; cursor: pointer; font-weight: 700; text-decoration: none; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.small { min-height: 34px; padding: 5px 12px; font-weight: 600; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.gap { height: 10px; }
.w90 { width: 90px; flex: none; }
.fab { position: fixed; right: 16px; bottom: calc(var(--tab-h) + 16px); z-index: 9; border-radius: 99px; box-shadow: 0 4px 12px rgba(1,49,98,.25); }

.link-box { display: flex; gap: 6px; align-items: center; }
.link-box input { font-size: 12px; }
.qr { width: 180px; height: 180px; display: block; margin: 10px auto 0; background: #fff; }

.note { white-space: pre-wrap; background: #f6f5f0; border-radius: 8px; padding: 10px; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 20px); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 50; max-width: 90vw; }
.toast.err { background: var(--red); }

/* 「?」の説明（ホバー・タップで開く） */
.tip { position: relative; display: inline-flex; }
.tip > button { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--sub); background: #fff; color: var(--sub); font-size: 11px; line-height: 1; padding: 0; cursor: help; }
.tip > .tip-body { display: none; position: absolute; left: 0; top: 24px; z-index: 20; width: 240px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 400; padding: 8px 10px; border-radius: 6px; }
.tip:hover > .tip-body, .tip.open > .tip-body { display: block; }

/* ログイン */
.auth-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.auth-card { background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 24px; width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 18px; color: var(--navy); margin: 0 0 16px; }

@media (min-width: 720px) {
  main#view { padding: 20px 20px calc(var(--tab-h) + 24px); }
  .home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .home-grid .card { margin-bottom: 0; }
  .stats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 360px) {
  .grid2 { grid-template-columns: 1fr; }
  .status-row input[type=date] { width: 130px; }
}
