/* =========================================================
   エコルドCRM — やわらかUIテーマ
   ========================================================= */
:root {
  --font: 'BIZ UDPGothic', 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Meiryo', sans-serif;
  --font-round: 'Zen Maru Gothic', 'BIZ UDPGothic', sans-serif;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #f8fbfa;
  --line: #e2e9e7;
  --text: #2f3b3a;
  --muted: #74817f;
  --primary: #3a9e8f;
  --primary-d: #2c8073;
  --primary-l: #e6f4f1;
  --accent: #f0a95c;
  --danger: #e06a6a;
  --radius: 14px;
  --radius-s: 10px;
  --shadow: 0 2px 10px rgba(47, 80, 76, .06);
  --shadow-l: 0 16px 48px rgba(30, 60, 56, .18);
  --side-w: 236px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg);
  font-size: 15px; line-height: 1.7; letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-round); font-weight: 700; margin: 0; letter-spacing: .04em; }
a { color: var(--primary-d); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  padding: .55em 1.1em; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 700; transition: .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-danger { color: var(--danger); border-color: #f2cccc; }
.btn-danger:hover { background: #fdf1f1; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: .3em .8em; font-size: 13px; }
.btn-block { width: 100%; padding: .8em; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--primary-l); color: var(--primary-d); }

/* ---------- フォーム ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 700; }
.field .req { color: var(--danger); margin-left: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .6em .85em; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: #fff; outline: none; transition: .15s;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-l); }
.form-error { color: var(--danger); font-size: 13px; min-height: 1.2em; margin: 4px 0 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span {
  display: inline-block; padding: .3em .8em; border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; cursor: pointer; background: #fff; transition: .15s;
}
.chip-check input:checked + span { background: var(--primary-l); border-color: var(--primary); color: var(--primary-d); font-weight: 700; }
.chip-check input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-l); }

/* ---------- ログイン ---------- */
.login-body { background: linear-gradient(140deg, #e8f5f1 0%, #f6f3ea 100%); min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 22px; padding: 40px 34px; box-shadow: var(--shadow-l); }
.brand-mark { display: flex; align-items: center; gap: 10px; justify-content: center; font-family: var(--font-round); font-size: 26px; font-weight: 700; color: var(--primary-d); }
.brand-mark img { width: 42px; height: 42px; }
.brand-mark b { color: var(--accent); margin-left: 2px; }
.login-lead { text-align: center; color: var(--muted); font-size: 14px; margin: 14px 0 26px; }
.login-note { font-size: 12px; color: var(--muted); text-align: center; margin: 22px 0 0; }
.pw-wrap { position: relative; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: none; color: var(--muted); cursor: pointer; padding: 6px; }

/* ---------- レイアウト ---------- */
.app-loading { display: grid; place-items: center; min-height: 100vh; }
.loader { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--primary-l); border-top-color: var(--primary); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side-w); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 30;
}
.sidebar .brand-mark { justify-content: flex-start; font-size: 20px; padding: 20px 20px 6px; }
.sidebar .brand-mark img { width: 32px; height: 32px; }
.org-badge { margin: 4px 20px 14px; font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 6px 10px; line-height: 1.5; }
.org-badge b { display: block; color: var(--text); font-size: 13px; }
.nav { flex: 1; overflow-y: auto; padding: 0 12px; }
.nav-label { font-size: 11px; color: var(--muted); margin: 14px 10px 4px; letter-spacing: .1em; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; margin-bottom: 2px; font-weight: 700; font-size: 14px;
}
.nav a i { width: 20px; text-align: center; color: var(--muted); }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--primary-l); color: var(--primary-d); }
.nav a.active i { color: var(--primary); }
.nav a .soon { margin-left: auto; font-size: 10px; background: #f3efe5; color: #a08453; border-radius: 6px; padding: 1px 6px; }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-l); color: var(--primary-d); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.side-foot .who { flex: 1; min-width: 0; font-size: 13px; line-height: 1.4; }
.side-foot .who small { color: var(--muted); display: block; font-size: 11px; }

.main { flex: 1; min-width: 0; }
.topbar { display: none; }
.page { padding: 28px 32px 60px; max-width: 1400px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 22px; margin-right: auto; }
.page-head h1 small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 8px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h3 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h3 i { color: var(--primary); }

/* ---------- ダッシュボード ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { padding: 18px 20px; }
.stat .lbl { font-size: 12px; color: var(--muted); font-weight: 700; }
.stat .num { font-family: var(--font-round); font-size: 30px; font-weight: 700; line-height: 1.3; }
.stat .num small { font-size: 14px; color: var(--muted); margin-left: 3px; }
.stat i { float: right; font-size: 20px; color: var(--primary); background: var(--primary-l); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.funnel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; cursor: pointer; border-radius: 8px; padding: 2px 4px; }
.funnel-row:hover { background: var(--surface-2); }
.funnel-row .fl { width: 118px; font-size: 13px; flex-shrink: 0; }
.funnel-row .bar { flex: 1; height: 18px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.funnel-row .bar span { display: block; height: 100%; border-radius: 999px; min-width: 4px; transition: width .4s; }
.funnel-row .fn { width: 34px; text-align: right; font-weight: 700; font-size: 14px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 9px 2px; border-bottom: 1px dashed var(--line); font-size: 13px; display: flex; gap: 10px; align-items: center; cursor: pointer; }
.list-plain li:last-child { border-bottom: none; }
.list-plain li:hover { color: var(--primary-d); }
.list-plain .date { color: var(--muted); font-size: 12px; flex-shrink: 0; min-width: 70px; }
.list-plain .date.overdue { color: var(--danger); font-weight: 700; }
.empty { color: var(--muted); text-align: center; padding: 22px 0; font-size: 13px; }

/* ---------- ステータスバッジ ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: .18em .75em; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; color: #fff; line-height: 1.6;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.85); }
.tag { display: inline-block; font-size: 11px; padding: .1em .6em; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); margin: 1px 2px 1px 0; white-space: nowrap; }
.tag.p { background: #eef6fb; border-color: #d4e7f3; color: #3c6f93; }
.tag.n { background: #fbf4ea; border-color: #f1e1c6; color: #93703c; }

/* ---------- ツールバー ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 36px; border-radius: 999px; }
.toolbar select { width: auto; max-width: 210px; border-radius: 999px; padding: .5em 2em .5em 1em; }
.view-switch { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.view-switch button { border: none; background: none; padding: .35em .9em; border-radius: 999px; cursor: pointer; font-weight: 700; color: var(--muted); font-size: 13px; }
.view-switch button.on { background: var(--primary); color: #fff; }
.status-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: thin; }
.status-tabs button {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .3em .9em; cursor: pointer;
  font-size: 13px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.status-tabs button .dot { width: 8px; height: 8px; border-radius: 50%; }
.status-tabs button .cnt { font-size: 11px; color: var(--muted); }
.status-tabs button.on { border-color: var(--text); font-weight: 700; }

/* ---------- テーブル ---------- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tbody tr { cursor: pointer; transition: background .12s; }
table.list tbody tr:hover { background: #f3faf8; }
table.list tbody tr.sel { background: var(--primary-l); }
table.list tr:last-child td { border-bottom: none; }
.cell-name b { display: block; }
.cell-name small { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }

/* ---------- カンバン ---------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kcol { width: 216px; flex-shrink: 0; background: #eef3f2; border-radius: var(--radius); padding: 10px; max-height: calc(100vh - 230px); display: flex; flex-direction: column; }
.kcol-head { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; padding: 4px 4px 10px; }
.kcol-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.kcol-head .cnt { margin-left: auto; background: #fff; border-radius: 999px; padding: 0 8px; font-size: 12px; color: var(--muted); }
.kcol-body { overflow-y: auto; min-height: 60px; flex: 1; border-radius: 10px; transition: background .15s; }
.kcol-body.over { background: rgba(58, 158, 143, .12); }
.kcard { background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06); cursor: grab; border-left: 4px solid transparent; font-size: 13px; }
.kcard:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.kcard.dragging { opacity: .45; }
.kcard b { display: block; font-size: 14px; }
.kcard small { color: var(--muted); display: block; line-height: 1.5; }

/* ---------- スライドパネル ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(30, 45, 43, .3); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 80; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 100vw); background: #fff; z-index: 90;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); box-shadow: var(--shadow-l);
  display: flex; flex-direction: column; border-radius: 20px 0 0 20px;
}
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.drawer-head .top { display: flex; align-items: flex-start; gap: 10px; }
.drawer-head h2 { font-size: 20px; flex: 1; line-height: 1.4; }
.drawer-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.drawer-head .quick { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.drawer-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.drawer-tabs button { border: none; background: none; padding: 12px 14px; cursor: pointer; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; }
.drawer-tabs button.on { color: var(--primary-d); border-bottom-color: var(--primary); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.drawer-foot { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 0 20px; }

.status-stepper { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 18px; }
.status-stepper button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .25em .75em; font-size: 12px; cursor: pointer; transition: .15s; }
.status-stepper button:hover { border-color: var(--primary); }
.status-stepper button.on { color: #fff; font-weight: 700; border-color: transparent; }

.info-list { display: grid; grid-template-columns: 120px 1fr; gap: 10px 14px; font-size: 14px; margin: 0 0 18px; }
.info-list dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.info-list dd { margin: 0; word-break: break-all; }
.info-list dd a { text-decoration: none; }
.section-title { font-size: 13px; color: var(--muted); font-weight: 700; margin: 18px 0 8px; display: flex; align-items: center; gap: 6px; }
.memo-box { background: var(--surface-2); border-radius: var(--radius-s); padding: 12px 14px; white-space: pre-wrap; font-size: 14px; min-height: 44px; }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 16px 44px; font-size: 14px; }
.timeline .ic { position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: var(--primary-l); color: var(--primary-d); border: 3px solid #fff; }
.timeline .ic.status { background: #fdf0e1; color: #c07a2a; }
.timeline .ic.system { background: #eef0f2; color: #7c858e; }
.timeline .meta { font-size: 12px; color: var(--muted); }
.timeline .ct { white-space: pre-wrap; }
.act-form { background: var(--surface-2); border-radius: var(--radius-s); padding: 12px; margin-bottom: 18px; }
.act-form .kinds { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.act-form textarea { min-height: 70px; }

/* ---------- モーダル ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(30, 45, 43, .35); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal { background: #fff; border-radius: 20px; width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; padding: 26px; box-shadow: var(--shadow-l); animation: pop .25s; }
.modal h2 { font-size: 18px; margin-bottom: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }

/* ---------- トースト ---------- */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #2f3b3a; color: #fff; padding: 10px 20px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow-l); animation: pop .25s; }
.toast.err { background: var(--danger); }

/* ---------- 準備中 ---------- */
.coming { text-align: center; padding: 60px 20px; }
.coming i.big { font-size: 46px; color: var(--primary); background: var(--primary-l); width: 96px; height: 96px; border-radius: 28px; display: grid; place-items: center; margin: 0 auto 18px; }
.coming ul { text-align: left; display: inline-block; color: var(--muted); font-size: 14px; }

/* ---------- レスポンシブ ---------- */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-l); }
  .sidebar.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .topbar .brand-mark { font-size: 17px; }
  .topbar .brand-mark img { width: 26px; height: 26px; }
  .page { padding: 18px 14px 50px; }
  .grid-2 { grid-template-columns: 1fr; }
  .info-list { grid-template-columns: 96px 1fr; }
  .drawer { border-radius: 0; }
  .hide-sm { display: none; }
  .search-box { max-width: none; }
}

/* ---------- フェーズ3：メルマガ ---------- */
.notice { display: flex; gap: 12px; background: #fdf6ea; border: 1px solid #f1e1c6; color: #7a5b2a; border-radius: var(--radius); padding: 12px 16px; font-size: 13px; margin-bottom: 16px; }
.notice i { margin-top: 3px; }
.page-tabs { padding: 0; background: transparent; }
.help { font-size: 13px; background: var(--surface-2); border-radius: var(--radius-s); padding: 8px 12px; margin-bottom: 10px; }
.help summary { cursor: pointer; color: var(--primary-d); font-weight: 700; }
.help ul { margin: 8px 0 2px; padding-left: 1.2em; color: var(--muted); }
code { background: #eef3f2; border-radius: 5px; padding: 0 5px; font-size: 12px; }
.progress { height: 14px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 16px 0 8px; }
.progress span { display: block; height: 100%; background: var(--primary); transition: width .3s; }
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--primary-l); border-radius: var(--radius-s); padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.bulk-bar select { width: auto; }
.bulk-bar[hidden] { display: none; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.group-card { text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit; color: inherit; transition: .15s; }
.group-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.group-card .num { font-family: var(--font-round); font-size: 26px; font-weight: 700; }
.group-card .num small { font-size: 12px; color: var(--muted); margin-left: 4px; }
td.sel-cell, th:first-child input { cursor: default; }
.drawer:has(#camp-form) { width: min(760px, 100vw); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-card { max-width: 640px; }
[hidden] { display: none !important; }

/* ---------- フェーズ4 ---------- */
.repeat { display: inline-block; font-size: 11px; font-weight: 700; color: #c07a2a; background: #fdf0e1; border-radius: 6px; padding: 0 5px; margin-left: 4px; vertical-align: middle; }
.csv-sample { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 12px; overflow-x: auto; margin: 0 0 12px; }
.imp-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.imp-summary div { background: var(--primary-l); border-radius: 12px; padding: 10px; text-align: center; }
.imp-summary div.err { background: #fdf1f1; color: var(--danger); }
.imp-summary b { display: block; font-size: 24px; font-family: var(--font-round); }
.imp-summary small { font-size: 12px; color: var(--muted); }
.url-box { display: flex; gap: 6px; align-items: center; }
.url-box input { font-size: 12px; }
.form-card { display: flex; flex-direction: column; gap: 6px; }
.form-card .head { display: flex; gap: 8px; align-items: flex-start; }
.form-card .head b { flex: 1; font-size: 15px; line-height: 1.5; }
.aud { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.aud.b2b { background: #eef6fb; color: #3c6f93; }
.aud.b2c { background: #fbeef4; color: #a34a74; }
.stat-mini { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.stat-mini b { color: var(--text); font-size: 16px; }
a.btn { text-decoration: none; }

/* ===== 北村ナレッジ ===== */
.small { font-size: 12px; }
.spacer { flex: 1; }
.kb-warn { background: #fff8e8; border-color: #f1e1c6; color: #93703c; font-size: 13px; margin-bottom: 14px; padding: 12px 16px; }
.kb-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.kb-cats { padding: 8px; position: sticky; top: 12px; max-height: calc(100vh - 40px); overflow: auto; }
.kb-cats button { display: flex; width: 100%; justify-content: space-between; gap: 6px; border: none; background: none; padding: 8px 10px; border-radius: 10px; cursor: pointer; text-align: left; font-size: 13px; color: var(--text); }
.kb-cats button b { color: var(--muted); font-weight: 500; font-size: 12px; }
.kb-cats button:hover { background: var(--surface-2); }
.kb-cats button.on { background: var(--primary-l); color: var(--primary-d); font-weight: 700; }
.kb-cats button i { color: #c48a3a; font-size: 11px; }
.kb-list { display: grid; gap: 10px; }
.kb-card { padding: 14px 18px; cursor: pointer; transition: border-color .15s, transform .15s; }
.kb-card:hover { border-color: var(--primary); }
.kb-card h3 { font-size: 15px; margin: 6px 0 4px; }
.kb-card-head, .kb-card-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.kb-card-foot { margin-top: 8px; color: var(--muted); }
.kb-ex { margin: 0; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kind-badge, .vis-badge, .era-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: .15em .65em; border-radius: 999px; white-space: nowrap; }
.kind-badge { background: #eef6fb; color: #3c6f93; }
.kind-badge.principle { background: #e6f4f1; color: #23756a; }
.kind-badge.qa { background: #f3eefb; color: #6a4c93; }
.kind-badge.ng { background: #fdf0f0; color: #b94a4a; }
.kind-badge.doc { background: #fbf4ea; color: #93703c; }
.vis-badge { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.vis-badge.public { color: #23756a; }
.vis-badge.private { color: #8a6d3b; }
.era-badge { background: #fff4e0; color: #a86a12; border: 1px solid #f3dcb2; }
.era-badge.cur { background: #ec8a4f; color: #fff; border-color: #ec8a4f; }
.kind-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.kind-pick .chip-check input:disabled + span { opacity: .4; }
.kb-era-note { background: #fff4e0; border: 1px solid #f3dcb2; border-radius: 10px; padding: 10px 12px; font-size: 13px; color: #8a5a10; margin: -4px 0 14px; }
.kb-file { font-size: 13px; margin: 0 0 6px; }
.kb-pages { display: grid; gap: 8px; margin-top: 8px; max-height: 420px; overflow: auto; }
.kb-page { display: flex; gap: 10px; font-size: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.kb-page img { width: 90px; height: auto; border: 1px solid var(--line); border-radius: 4px; flex-shrink: 0; }
.kb-page p { margin: 2px 0 0; color: var(--muted); white-space: pre-wrap; max-height: 5.4em; overflow: hidden; }
.kb-progress { margin-top: 14px; font-size: 13px; color: var(--muted); }
.kb-progress .bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.kb-progress .bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .3s; }
.kb-cat-edit { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.kb-cat-edit li { display: flex; align-items: center; gap: 8px; }
.kb-cat-edit li.off input[data-name] { opacity: .5; }
.kb-cat-edit .ord { display: flex; }
.kb-cat-edit .ord .icon-btn { width: 26px; height: 26px; font-size: 11px; }
.kb-cat-edit input[data-name] { flex: 1; }
.kb-test { display: grid; gap: 14px; max-width: 900px; }
.kt-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.kt-text { font-size: 15px; line-height: 1.85; }
.kt-text p { margin: 0 0 10px; }
.kt-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.kt-hits { padding-left: 1.4em; margin: 12px 0 0; display: grid; gap: 10px; }
.kt-hits p { margin: 4px 0 0; white-space: pre-wrap; }
sup.ref { display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; font-size: 10px; background: var(--primary-l); color: var(--primary-d); border-radius: 99px; margin: 0 1px; font-weight: 700; vertical-align: super; }
.ai-refs { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; font-size: 13px; }
.ai-refs > b { font-size: 12px; color: var(--muted); }
.ai-ref { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.ai-ref img { width: 120px; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; flex-shrink: 0; background: #fff; }
.ai-ref-ic { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: #fff; color: var(--primary); flex-shrink: 0; }
.ref-n { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; font-size: 11px; background: var(--primary); color: #fff; border-radius: 99px; font-weight: 700; }
.consult-cta { margin-top: 12px; background: linear-gradient(135deg, #fff4e0, #fdeee4); border: 1px solid #f3dcb2; border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.consult-cta .who { width: 40px; height: 40px; border-radius: 50%; background: #ec8a4f; color: #fff; display: grid; place-items: center; font-size: 17px; flex-shrink: 0; }
.consult-cta p { margin: 0; flex: 1; min-width: 180px; font-size: 13px; color: #6b4a1a; }
.img-zoom { position: fixed; inset: 0; background: rgba(20,30,28,.75); display: grid; place-items: center; z-index: 200; padding: 20px; cursor: zoom-out; }
.img-zoom img { max-width: min(1000px, 100%); max-height: 92vh; border-radius: 8px; background: #fff; }
@media (max-width: 860px) {
  .kb-layout { grid-template-columns: 1fr; }
  .kb-cats { position: static; display: flex; flex-wrap: wrap; gap: 4px; max-height: none; }
  .kb-cats button { width: auto; }
  .ai-ref img { width: 84px; }
}
/* ===== 5-2 ===== */
.ai-note { background: #f3eefb; border: 1px solid #e2d6f3; color: #5a3f86; border-radius: 10px; padding: 9px 12px; font-size: 13px; margin: 0 0 12px; }
.sched-note { background: #eef3fb; border: 1px solid #d4e0f3; color: #3c5a93; border-radius: 10px; padding: 9px 12px; font-size: 13px; }
.step-card { padding: 12px 14px; margin-bottom: 10px; }
.step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 13px; }
.step-head input[type=number] { padding: .35em .5em; }
.step-head select { padding: .35em 1.8em .35em .6em; }
.auto-card { cursor: pointer; margin-bottom: 10px; padding: 14px 18px; }
.auto-card .head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.auto-card:hover { border-color: var(--primary); }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 14px; }
