* { box-sizing: border-box; }
:root {
  --bg:#f4f6f9; --panel:#fff; --ink:#1f2430; --muted:#8a93a3; --line:#e4e8ef;
  --accent:#1f6e43; --accent2:#2f5496; --shibun:#2f5496;
  --b-all:#2f5496; --b-sho:#1f6e43; --b-kei:#9c6500; --b-sai:#7030a0;
  --hover:#eef7f1;
}
html,body { margin:0; height:100%; font-family:-apple-system,"Hiragino Kaku Gothic ProN","Noto Sans JP",sans-serif; color:var(--ink); background:var(--bg); font-size:13px; }
#app { display:flex; height:100vh; }
.auth-screen { position:fixed; inset:0; z-index:200; display:flex; align-items:center; justify-content:center; background:var(--bg); }
.auth-card { width:min(380px, calc(100vw - 32px)); padding:28px; border:1px solid var(--line); border-radius:14px; background:var(--panel); box-shadow:0 16px 50px rgba(20,26,38,.16); }
.auth-card h1 { margin:0; font-size:22px; }
.auth-subtitle { margin:6px 0 22px; color:var(--muted); }
.auth-card label { display:flex; flex-direction:column; gap:6px; margin:14px 0; color:var(--muted); font-size:12px; }
.auth-card input { padding:9px 10px; border:1px solid var(--line); border-radius:7px; color:var(--ink); font-size:14px; }
.auth-card button { width:100%; margin-top:8px; padding:10px; border:0; border-radius:7px; background:var(--accent); color:#fff; cursor:pointer; font-size:14px; font-weight:600; }
.auth-card button:disabled { opacity:.6; cursor:wait; }
.confirm-modal { position:fixed; inset:0; z-index:400; display:flex; align-items:center; justify-content:center; padding:16px; background:rgba(20,26,38,.34); }
.confirm-card { width:min(360px, calc(100vw - 32px)); padding:24px; border:1px solid var(--line); border-radius:14px; background:var(--panel); box-shadow:0 18px 55px rgba(20,26,38,.24); }
.confirm-card h2 { margin:0; font-size:18px; }
.confirm-card p { margin:10px 0 20px; color:var(--muted); }
.confirm-actions { display:flex; justify-content:flex-end; gap:8px; }
.confirm-actions button { min-width:92px; padding:8px 14px; border:1px solid var(--line); border-radius:7px; background:#fbfcfe; color:var(--ink); cursor:pointer; font-size:12px; }
.confirm-actions button:hover { background:var(--hover); }
.confirm-actions #logout-confirm { border-color:#d64545; background:#d64545; color:#fff; }
.confirm-actions #logout-confirm:hover { background:#bb3838; }
.confirm-actions button:disabled { opacity:.6; cursor:wait; }

/* sidebar */
#side { width:248px; min-width:248px; background:var(--panel); border-right:1px solid var(--line); display:flex; flex-direction:column; }
.brand { display:flex; gap:10px; align-items:center; padding:16px; border-bottom:1px solid var(--line); }
.brand .logo { width:38px; height:38px; border-radius:9px; background:linear-gradient(135deg,var(--accent),#2f9c63); color:#fff; font-weight:800; display:flex; align-items:center; justify-content:center; font-size:13px; }
.brand .titles { display:flex; flex-direction:column; line-height:1.3; }
.brand .titles b { font-size:14px; }
.brand .titles span { font-size:10.5px; color:var(--muted); }
.ctrls { padding:12px 14px; display:flex; flex-direction:column; gap:9px; border-bottom:1px solid var(--line); }
.ctrls label { font-size:11px; color:var(--muted); display:flex; flex-direction:column; gap:4px; }
.ctrls select { font-size:13px; padding:6px 8px; border:1px solid var(--line); border-radius:7px; background:#fbfcfe; color:var(--ink); }
nav { flex:1; overflow-y:auto; padding:8px 8px 16px; }
nav .grp { font-size:10px; color:var(--muted); font-weight:700; letter-spacing:.04em; padding:12px 8px 4px; }
nav a { display:block; padding:7px 10px; border-radius:7px; color:var(--ink); text-decoration:none; cursor:pointer; font-size:12.5px; }
nav a:hover { background:var(--hover); }
nav a.active { background:var(--accent); color:#fff; font-weight:600; }
.foot { padding:10px 14px; border-top:1px solid var(--line); }
.foot .meta { font-size:10.5px; color:var(--muted); margin-bottom:8px; line-height:1.5; }
.foot button { width:100%; padding:7px; border:1px solid var(--line); background:#fbfcfe; border-radius:7px; cursor:pointer; font-size:12px; color:var(--ink); }
.foot button + button { margin-top:6px; }
.foot button:hover { background:var(--hover); }
.foot .howto-link { display:block; text-align:center; margin-top:7px; font-size:11px; color:var(--accent); cursor:pointer; text-decoration:none; }
.foot .howto-link:hover { text-decoration:underline; }

/* main */
#main { flex:1; display:flex; flex-direction:column; overflow:hidden; }
#head { padding:16px 22px 10px; border-bottom:1px solid var(--line); background:var(--panel); }
#head h1 { margin:0; font-size:18px; }
#head .note { margin:5px 0 0; font-size:11.5px; color:var(--muted); }
#content { flex:1; overflow:auto; padding:16px 22px 60px; }
.loading { color:var(--muted); padding:40px; text-align:center; }

/* table */
.tbl-wrap { overflow:auto; border:1px solid var(--line); border-radius:10px; background:var(--panel); max-height:calc(100vh - 150px); }
table.grid { border-collapse:separate; border-spacing:0; font-size:12px; white-space:nowrap; }
table.grid th, table.grid td { border-bottom:1px solid var(--line); border-right:1px solid var(--line); padding:5px 8px; text-align:right; }
table.grid.raw-grid { min-width:100%; }
table.grid thead th { position:sticky; top:0; z-index:3; background:#eef1f6; color:#33405c; font-weight:700; text-align:center; }
table.grid thead tr.groups th { top:0; z-index:4; color:#fff; }
table.grid thead tr.subs th { top:26px; }
table.grid thead tr.single th { top:0; }
table.grid th.corner, table.grid td.rowlabel { position:sticky; left:0; z-index:2; background:#eef2f7; color:#222; text-align:left; font-weight:700; min-width:92px; padding:6px 12px; box-shadow:2px 0 5px -2px rgba(30,50,80,.18); }
table.grid td.rowlabel { font-size:12.5px; letter-spacing:.02em; }
table.grid td.rowlabel .wd-sat { color:#2f6bd6; } table.grid td.rowlabel .wd-sun { color:#d64545; }
table.grid thead th.corner { z-index:6; background:#e3e9f2; }
/* 縞模様（数値セルのみ・合計/月見出しは除外） */
table.grid tbody tr:nth-child(even):not(.total):not(.monthhead) td.num { background:#f7fafd; }
table.grid tbody tr:hover td { background:#eef6ff; }
table.grid tbody tr:hover td.rowlabel { background:#dfeaf6; }
td.num { font-variant-numeric:tabular-nums; }
td.rate { color:#5a6373; }
td.drill { cursor:pointer; color:var(--accent2); }
td.drill:hover { background:var(--hover)!important; text-decoration:underline; }
td.zero { color:#c2c9d4; }
tr.total td { background:#fce9dc!important; font-weight:700; }
tr.total td.rowlabel { background:#fbe0cf!important; }
tr.monthhead td { background:#eaf0f8!important; font-weight:700; color:#2f5496; text-align:left; }
table.grid thead tr.groups th[class^="g-全体"]{ background:var(--b-all); }
table.grid thead tr.groups th[class^="g-初診"]{ background:var(--b-sho); }
table.grid thead tr.groups th[class^="g-経過再診"]{ background:#8a5900; }
table.grid thead tr.groups th[class^="g-再診"]{ background:var(--b-sai); }
table.grid thead tr.subs th.sub-全体{ background:#c9d6ee; color:#1e3a6b; }
table.grid thead tr.subs th.sub-初診{ background:#c6e4d3; color:#0f5230; }
table.grid thead tr.subs th.sub-経過再診{ background:#efdcae; color:#573700; }
table.grid thead tr.subs th.sub-再診{ background:#ddccef; color:#3d1c63; }

/* docs */
.docs { max-width:100%; }
/* 文章主体のタブだけ読みやすさのため少し幅を抑える。表主体のタブは全幅で使う */
.docsec[data-sec="usage"] > *, .docsec[data-sec="qa"] > *, .docsec[data-sec="glossary"] > *,
.docsec[data-sec="reservations"] > *, .docsec[data-sec="computed"] > * { max-width:1500px; }
.docs h2 { font-size:16px; margin:22px 0 8px; border-bottom:2px solid var(--accent); padding-bottom:4px; }
.docs h3 { font-size:14px; margin:16px 0 6px; color:var(--accent2); }
.docs .muted { color:var(--muted); font-size:11.5px; margin:2px 0 8px; }
table.doctable { border-collapse:collapse; width:100%; font-size:12px; margin-bottom:10px; background:var(--panel); }
table.doctable th, table.doctable td { border:1px solid var(--line); padding:6px 9px; text-align:left; vertical-align:top; }
table.doctable th { background:#eef1f6; }
table.doctable td.k { font-weight:600; white-space:nowrap; width:220px; }
table.doctable td.c { text-align:center; color:var(--muted); width:44px; }
table.doctable td.v { color:#5a6373; font-size:11px; width:210px; }
.docs .howto { background:#f0f7f2; border:1px solid #cfe6d8; border-radius:10px; padding:14px 18px; margin-bottom:8px; }
.docs .howto h2 { border:none; margin-top:4px; }
.docs .howto ol { margin:8px 0; padding-left:22px; }
.docs .howto li { margin:6px 0; line-height:1.6; }
.docs code { background:#e7efe9; padding:1px 6px; border-radius:5px; font-size:11.5px; word-break:break-all; }
.docs pre { background:#1f2430; color:#e6edf3; padding:10px 14px; border-radius:8px; overflow:auto; font-size:12px; }
.docs pre + p { margin-top:6px; }
.docs .warn { background:#fff4e5; border:1px solid #f0c98a; border-radius:8px; padding:8px 12px; font-size:12px; line-height:1.6; color:#7a4a00; }

/* raw */
.rawbar { display:flex; gap:10px; align-items:center; margin-bottom:10px; }
.rawbar input { padding:7px 10px; border:1px solid var(--line); border-radius:7px; font-size:13px; width:280px; }
.rawbar .pager { display:flex; gap:6px; align-items:center; margin-left:auto; }
.rawbar button { padding:6px 12px; border:1px solid var(--line); background:#fbfcfe; border-radius:7px; cursor:pointer; }
.rawbar button:disabled { opacity:.4; cursor:default; }
.pill { background:#e7eef8; color:#2f5496; border-radius:20px; padding:2px 10px; font-size:11px; font-weight:600; }
.stage-初診{ color:#1f6e43; } .stage-経過再診{ color:#9c6500; } .stage-再診{ color:#7030a0; font-weight:600; }

/* modal */
.modal { position:fixed; inset:0; background:rgba(20,26,38,.45); display:flex; align-items:center; justify-content:center; z-index:50; }
.modal.hidden { display:none; }
.modal-box { background:var(--panel); border-radius:12px; width:min(1500px,96vw); max-height:86vh; display:flex; flex-direction:column; box-shadow:0 20px 60px rgba(0,0,0,.3); }
.modal-head { display:flex; justify-content:space-between; align-items:center; gap:18px; padding:14px 18px; border-bottom:1px solid var(--line); flex-wrap:nowrap; }
.modal-head > div:first-child { white-space:nowrap; flex-shrink:0; }
.modal-actions { flex-shrink:0; }
.modal-head button { border:none; background:none; font-size:18px; cursor:pointer; color:var(--muted); }
.modal-body { overflow:auto; padding:0; }
.modal-body table { border-collapse:collapse; width:100%; font-size:11.5px; white-space:nowrap; }
.modal-body th, .modal-body td { border-bottom:1px solid var(--line); border-right:1px solid var(--line); padding:5px 8px; text-align:left; }
.modal-body thead th { position:sticky; top:0; background:#eef1f6; z-index:1; }

/* クリックでコピーできる列ヘッダー */
th.copycol { cursor:pointer; user-select:none; white-space:nowrap; }
th.copycol:hover { background:#dbe7f7!important; color:#1f4e8a; }
th.copycol .copyhint { opacity:0; margin-left:5px; font-size:11px; color:#5a86c4; }
th.copycol:hover .copyhint { opacity:1; }
th.copycol .filtericon { margin-left:5px; font-size:11px; color:#8aa0bf; cursor:pointer; padding:0 3px; border-radius:4px; }
th.copycol .filtericon:hover { background:#c3d6ef; color:#1f4e8a; }
th.copycol .filtericon.on { color:#fff; background:#2f5496; opacity:1; }

/* モーダルヘッダーのアクションボタン */
.modal-actions { display:flex; align-items:center; gap:8px; }
.drill-search { border:1px solid #cdd6e3; background:#fff; border-radius:7px; padding:5px 10px; font-size:12px; width:170px; outline:none; }
.drill-search:focus { border-color:#2f5496; box-shadow:0 0 0 2px rgba(47,84,150,.15); }
.mbtn { border:1px solid var(--line); background:#f4f7fb; color:#2f5496; border-radius:7px; padding:5px 11px; font-size:12px; font-weight:600; cursor:pointer; }
.mbtn:hover { background:#e3ecf8; }

/* スプシ風フィルタのポップオーバー */
.filterpop { position:fixed; z-index:120; background:#fff; border:1px solid #c7d2e0; border-radius:10px; box-shadow:0 12px 34px rgba(20,26,38,.28); width:240px; padding:10px; font-size:12px; }
.filterpop .fp-head { font-weight:700; color:#2f5496; margin-bottom:7px; }
.filterpop .fp-search { width:100%; box-sizing:border-box; border:1px solid #cdd6e3; border-radius:6px; padding:5px 8px; font-size:12px; margin-bottom:6px; }
.filterpop .fp-all { display:block; font-weight:600; padding:3px 2px; border-bottom:1px solid var(--line); margin-bottom:4px; cursor:pointer; }
.filterpop .fp-list { max-height:240px; overflow:auto; }
.filterpop .fp-item { display:flex; align-items:center; gap:6px; padding:3px 2px; cursor:pointer; white-space:nowrap; }
.filterpop .fp-item:hover { background:#f0f4fa; }
.filterpop .fp-item span { overflow:hidden; text-overflow:ellipsis; }
.filterpop .fp-btns { display:flex; justify-content:space-between; gap:8px; margin-top:8px; }
.filterpop .fp-btns button { border:none; border-radius:6px; padding:6px 14px; font-size:12px; font-weight:600; cursor:pointer; }
.filterpop .fp-clear { background:#eef1f6; color:#555; }
.filterpop .fp-clear:hover { background:#e0e5ec; }
.filterpop .fp-apply { background:#2f5496; color:#fff; }
.filterpop .fp-apply:hover { background:#26457c; }

/* トースト */
#toast { position:fixed; top:20px; right:20px; width:min(380px, calc(100vw - 40px)); transform:translateY(-10px); padding:12px 16px; border-radius:9px; font-size:13px; line-height:1.4; box-shadow:0 10px 30px rgba(20,26,38,.18); opacity:0; pointer-events:none; transition:opacity .2s, transform .2s; z-index:300; }
#toast.error { background:#fff5f5; color:#b42318; border:1px solid #f0b8b4; }
#toast.success { background:#effaf3; color:#176b3a; border:1px solid #a7dfbb; }
#toast.show { opacity:1; transform:translateY(0); }

/* ===== 人物検索（MICO ID） ===== */
.empty-person { color:var(--muted); padding:30px; text-align:center; border:1px dashed var(--line); border-radius:10px; }
.pcard { border:1px solid var(--line); border-radius:12px; padding:16px 18px; background:#fff; box-shadow:0 1px 3px rgba(30,40,60,.05); margin-bottom:16px; }
.pcard .pname { font-size:17px; font-weight:700; margin-bottom:12px; display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; }
.pcard .pmico { font-size:11px; font-weight:600; color:#2f5496; background:#e7eef8; border-radius:20px; padding:2px 10px; }
.pgrid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 24px; }
.pkv { display:flex; gap:10px; padding:6px 0; border-bottom:1px dashed var(--line); align-items:baseline; }
.pkv .pk { font-size:11px; color:var(--muted); min-width:120px; }
.pkv .pv { font-size:13px; }
.pkv .pv b { font-size:15px; }
.cancelled { color:#c0392b; font-weight:700; }
.active-status { color:#1f6e43; }
.ptl-title { font-size:13px; margin:6px 0 8px; color:var(--ink); }
table.person-timeline td { white-space:nowrap; }
@media (max-width:720px){ .pgrid{ grid-template-columns:1fr; } }

/* MicoCloudリンク */
a.pmico.micolink { text-decoration:none; cursor:pointer; }
a.pmico.micolink:hover { background:#d7e3f5; }
.mico-btn { margin-left:auto; display:inline-flex; align-items:center; gap:4px; text-decoration:none;
  background:#06c755; color:#fff; font-size:12px; font-weight:700; padding:6px 14px; border-radius:8px; white-space:nowrap; }
.mico-btn:hover { background:#05a648; }
.mico-btn.pf-plain { background:#eef2f7; color:#3a5a72; border:1px solid #cddbe6; }
.mico-btn.pf-plain:hover { background:#e0e8f0; }
.pcard .pname { flex-wrap:wrap; }
/* 人物カードの「除外」ボタン */
.excl-btn { border:1px solid #e2b4b4; background:#fbeaea; color:#b3403a; font-size:12px; font-weight:700;
  padding:5px 12px; border-radius:8px; cursor:pointer; white-space:nowrap; }
.excl-btn:hover { background:#f3d6d6; }
.pf-excount { font-weight:800; color:#b3403a; background:#fbeaea; border:1px solid #e2b4b4; border-radius:20px; padding:3px 12px; font-size:12.5px; }

/* Q&A（列定義ページ内） */
.faq { margin-bottom:12px; }
.faq .qa { border:1px solid var(--line); border-radius:9px; padding:10px 13px; margin-bottom:8px; background:var(--panel); }
.faq .q { font-weight:700; font-size:13px; color:var(--ink); margin-bottom:5px; }
.faq .a { font-size:12.5px; color:#41474f; line-height:1.6; }
/* 列定義の区切り見出し行（― … ―） */
table.doctable td.k:first-child { line-height:1.5; }

/* 列定義ページ内タブ */
.doctabs { display:flex; flex-wrap:wrap; gap:6px; margin:2px 0 14px; border-bottom:2px solid var(--line); padding-bottom:8px; position:sticky; top:0; background:var(--bg); z-index:2; }
.doctab { padding:6px 13px; border:1px solid var(--line); background:#fbfcfe; border-radius:8px; cursor:pointer; font-size:12.5px; font-weight:600; color:var(--muted); }
.doctab:hover { background:#eef2f8; color:var(--ink); }
.doctab.active { background:var(--accent); border-color:var(--accent); color:#fff; }
.docsec.hidden { display:none; }
.docsec > h2 { margin-top:0; }

/* シート定義ボックス・定義マトリクス */
.sheetdef { background:#fff8e6; border:1px solid #f0d98a; border-left:4px solid #e0a800; border-radius:7px; padding:8px 11px; font-size:12px; line-height:1.6; margin:2px 0 9px; }
table.defmatrix { font-size:11.5px; width:100%; min-width:900px; }
table.defmatrix th { position:sticky; top:0; }
table.defmatrix td { vertical-align:top; }
table.defmatrix td.k { white-space:normal; width:auto; min-width:130px; }

/* 読む場所ガイド */
.guidebox { border:1px solid #bcd; background:#f2f7ff; border-radius:10px; padding:12px 14px; margin-bottom:16px; }
.guidebox > b { font-size:14px; display:block; margin-bottom:8px; }
.guidebox .doctable { margin-bottom:6px; }

/* 用語集「使う場所」列 */
td.gwhere { font-size:11px; color:#2f5496; white-space:normal; width:230px; }

/* 用語集：読みやすく分解 */
.glosstable td { vertical-align:top; }
.g-head { font-weight:700; display:block; color:var(--ink); line-height:1.55; }
.g-ul { margin:5px 0 2px; padding-left:18px; }
.g-ul li { margin:2px 0; line-height:1.5; }
.g-detail { color:#5a616b; font-size:11.5px; margin-top:4px; line-height:1.55; }
td.gwhere { font-size:11px; color:#2f5496; white-space:normal; width:200px; line-height:1.6; }
.chip { display:inline-block; padding:1px 8px; border-radius:20px; font-size:10.5px; font-weight:700; }
.chip-all { background:#dff3e6; color:#1f6e43; }
/* 段階マップ */
.stagemap { border:1px solid #d7e0ec; background:#f7faff; border-radius:10px; padding:12px 14px; margin-bottom:16px; }
.sm-title { font-weight:700; font-size:13.5px; margin-bottom:8px; }
.stagetable { max-width:560px; background:#fff; }
.stagetable td { padding:7px 10px; }
.stagepill { display:inline-block; padding:2px 12px; border-radius:20px; font-weight:700; font-size:12px; color:#fff; }
.stagepill.stage-初診 { background:#1f9d55; }
.stagepill.stage-経過再診 { background:#d98a00; }
.stagepill.stage-再診 { background:#7c4dc4; }

/* 定義マトリクスの色チップ */
.dchip { display:inline-block; padding:2px 8px; border-radius:6px; font-size:11px; font-weight:700; white-space:nowrap; }
.c-cnt { background:#eceff3; color:#5a616b; }         /* 件数=グレー */
.c-uu { background:#e3edfb; color:#2f5496; }          /* 実人数UU=青 */
.c-raw { background:#e2f3e8; color:#1f6e43; }         /* 生の購入履歴=緑 */
.c-badj { background:#efe6fa; color:#7c4dc4; }        /* B補正=紫 */
.c-jishin { background:#fdeede; color:#b5651d; }      /* 受診歴=茶 */
.c-none { background:#f4f5f7; color:#9aa1ac; }        /* 段階分けなし=薄灰 */
.c-buy2 { background:#e2f3e8; color:#1f6e43; }        /* 発送完了+注文確定=緑 */
.c-buy1 { background:#ffe8d6; color:#c0562a; border:1px solid #f0b98a; } /* 発送完了のみ=オレンジ強調 */
.c-rea { background:#e2f3e8; color:#1f6e43; }
.c-reb { background:#fff3d6; color:#9c6500; }
.c-au { background:#e3edfb; color:#2f5496; }
.c-each { background:#f4f5f7; color:#6b7280; }
.c-dash { background:transparent; color:#c2c8d0; font-weight:400; }

/* 期間セレクタ */
.hidden { display:none; }

.csv-toolbar { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:18px; }
.csv-toolbar h2 { margin:0 0 5px; font-size:22px; color:var(--ink); }
.csv-primary, .csv-secondary { display:inline-flex; align-items:center; justify-content:center; min-height:36px; padding:8px 14px; border-radius:8px; text-decoration:none; cursor:pointer; font-size:13px; font-weight:700; box-sizing:border-box; }
.csv-primary { border:1px solid var(--accent); background:var(--accent); color:#fff; }
.csv-primary:hover { filter:brightness(.95); }
.csv-secondary { border:1px solid var(--line); background:#fff; color:var(--ink); }
.csv-secondary:hover { background:#f7f9fc; }
.csv-table-wrap { overflow:auto; border:1px solid var(--line); border-radius:10px; background:#fff; }
.csv-table { width:100%; min-width:1050px; border-collapse:collapse; font-size:12px; }
.csv-table th, .csv-table td { padding:10px 12px; border-bottom:1px solid #edf0f5; text-align:left; vertical-align:top; white-space:nowrap; }
.csv-table th { background:#f6f8fb; color:var(--muted); font-size:11px; }
.csv-table tr:last-child td { border-bottom:none; }
.csv-name { max-width:260px; overflow:hidden; text-overflow:ellipsis; }
.csv-actions { display:flex; gap:6px; }
.csv-view { border:1px solid #b8cbe2; border-radius:7px; padding:5px 10px; background:#f6faff; color:#2f5496; cursor:pointer; font-size:12px; }
.csv-view:disabled { opacity:.45; cursor:not-allowed; }
.csv-status { display:inline-flex; padding:3px 9px; border-radius:999px; font-weight:700; }
.csv-status.ready { background:#e5f7eb; color:#18723c; }
.csv-status.importing { background:#fff4d6; color:#8b5e00; }
.csv-status.failed { background:#fde8e6; color:#b42318; }
.csv-error-text { max-width:300px; overflow:hidden; text-overflow:ellipsis; color:#b42318; }
.csv-delete { border:1px solid #e4b3b0; border-radius:7px; padding:5px 10px; background:#fff; color:#b42318; cursor:pointer; font-size:12px; }
.csv-delete:disabled { opacity:.45; cursor:not-allowed; }
.csv-empty, .csv-error-state { border:1px dashed var(--line); border-radius:10px; padding:46px 20px; text-align:center; background:#fff; color:var(--muted); }
.csv-empty strong, .csv-error-state strong { display:block; margin-bottom:8px; color:var(--ink); font-size:16px; }
.csv-empty p, .csv-error-state p { margin:0 0 18px; }
.csv-upload-modal-box { width:min(680px,96vw); }
.csv-modal-body { padding:18px; overflow:auto; }
.csv-field { display:flex; flex-direction:column; gap:7px; margin-bottom:16px; color:var(--ink); font-weight:700; font-size:13px; }
.csv-field select { width:100%; box-sizing:border-box; border:1px solid var(--line); border-radius:8px; padding:10px 12px; background:#fff; color:var(--ink); font-size:14px; }
.csv-dropzone { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:7px; min-height:150px; border:1px dashed #9bb2c8; border-radius:10px; background:#f8fbfe; cursor:pointer; text-align:center; }
.csv-dropzone:hover { border-color:var(--accent); background:#f1f8fc; }
.csv-dropzone input { position:absolute; width:1px; height:1px; opacity:0; }
.csv-drop-title { color:var(--accent); font-size:16px; font-weight:800; }
.csv-drop-help { color:var(--muted); font-size:12px; }
.csv-selected-file { min-height:20px; padding:10px 0; color:var(--muted); font-size:13px; }
.csv-field-error { display:none; margin-top:6px; color:#b42318; font-size:12px; font-weight:500; }
.csv-field-error.show { display:block; }
.csv-form-message { display:none; margin:5px 0 14px; padding:10px 12px; border-radius:8px; background:#fff5f5; border:1px solid #f0b8b4; color:#b42318; font-size:13px; }
.csv-form-message.show { display:block; }
.csv-upload-progress { display:flex; align-items:center; gap:10px; margin:5px 0 14px; color:#8b5e00; font-size:13px; }
.csv-upload-progress.hidden { display:none; }
.csv-upload-progress span { width:16px; height:16px; border:2px solid #eadca8; border-top-color:#b78300; border-radius:50%; animation:csv-spin .8s linear infinite; }
.csv-form-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:10px; }
.csv-view-modal-box { width:min(1400px,96vw); }
.csv-view-body { padding:0 0 12px; }
.csv-view-meta { padding:12px 18px; color:var(--muted); font-size:12px; }
.csv-view-table-wrap { max-height:62vh; overflow:auto; }
.csv-view-table { min-width:max-content; }
.csv-view-pager { display:flex; align-items:center; justify-content:center; gap:14px; padding:12px 18px 0; }
.csv-view-pager button:disabled { opacity:.45; cursor:not-allowed; }
@keyframes csv-spin { to { transform:rotate(360deg); } }
@media (max-width:760px) { .csv-toolbar { flex-direction:column; } .csv-toolbar > .csv-primary, .csv-toolbar > .csv-secondary { align-self:stretch; } }
#customrange { display:flex; align-items:center; gap:5px; font-size:11px; color:var(--muted); margin-top:2px; }
#customrange input[type=date] { padding:4px 6px; border:1px solid var(--line); border-radius:6px; font-size:11px; }
#period { font-weight:600; }

/* 着予（着地予測）行 */
tr.project td { background:#e8f0fb!important; font-weight:700; color:#2f5496; }
tr.project td.rowlabel { background:#dbe7f8!important; color:#24467e; }

/* 日次ログの前日差 */
.delta { font-size:11px; font-weight:700; margin-left:4px; }
.delta.up { color:#1f9d55; }
.delta.down { color:#c0392b; }
td.delta { font-variant-numeric:tabular-nums; }

/* Downloads取込ボタン */
#importDl { width:100%; padding:8px; border:1px solid #1f9d55; background:#e9f7ef; color:#146c43; border-radius:7px; cursor:pointer; font-size:12px; font-weight:700; margin-bottom:7px; }
#importDl:hover { background:#d7f0e0; }
#importDl:disabled { opacity:.6; cursor:default; }

/* ═══ 配信効果トラッカー ═══ */
.tk-controls { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:4px 0 10px; }
.tk-controls label { font-size:12px; color:var(--muted); display:flex; gap:6px; align-items:center; }
.tk-controls select { font-size:13px; padding:5px 8px; border:1px solid var(--line); border-radius:7px; background:#fbfcfe; color:var(--ink); }
.tk-arrow { color:var(--muted); font-weight:700; }
.tk-cap { font-size:12.5px; color:var(--ink); }
.tk-warn { color:#b26a00; }
.tk-bc { font-size:12px; color:var(--muted); margin:0 0 12px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.tk-bc input { font-size:12.5px; padding:5px 8px; border:1px solid var(--line); border-radius:7px; min-width:280px; }
.tk-bc button { font-size:12px; padding:5px 12px; border:1px solid var(--accent); background:var(--accent); color:#fff; border-radius:7px; cursor:pointer; }
.tk-panel { background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:16px 18px; margin-bottom:16px; }
.tk-panel > h3 { font-size:16px; margin:0 0 14px; color:var(--ink); }
.tk-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:16px; }
.tk-card { border:1px solid var(--line); border-radius:10px; padding:18px 20px; background:#fff; }
.tk-card.good { border-color:#8fd0a8; background:#f2fbf6; }
.tk-card.bad { border-color:#f0b0aa; background:#fdf3f2; }
.tk-card-top { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:8px; }
.tk-card-label { font-size:16px; color:#5a6373; font-weight:700; line-height:1.35; }
.tk-card-rate { font-size:44px; font-weight:800; color:var(--ink); }
.tk-card-rate span { font-size:22px; font-weight:600; color:var(--muted); margin-left:3px; }
.tk-card-rate.up { color:#1f9d55; } .tk-card-rate.down { color:#d64545; }
.tk-card-sub { font-size:14px; color:var(--muted); margin-top:5px; }
.tk-card-nums { font-size:14px; color:#48566b; margin-top:10px; padding-top:8px; border-top:1px dashed var(--line); line-height:1.65; }
.tk-card-nums b { color:#2b3a4d; }
.tk-card-nums .tk-dnum.up { color:#1f9d55; } .tk-card-nums .tk-dnum.down { color:#d64545; }
.tk-card-nums .tk-cv { color:#7d6a3a; font-size:13px; }
.tk-card-nums .tk-cv b { color:#9c6500; }
.tk-card-delta { font-size:34px; font-weight:800; }
.tk-card-delta.up { color:#1f9d55; } .tk-card-delta.down { color:#d64545; }
.tk-badge { font-size:13px; font-weight:700; padding:3px 10px; border-radius:20px; white-space:nowrap; }
.tk-badge.up { background:#e2f6ea; color:#1f9d55; } .tk-badge.down { background:#fde7e5; color:#d64545; } .tk-badge.flat { background:#eef1f6; color:#8a93a3; }
.tk-bar { height:5px; background:#eef1f6; border-radius:4px; overflow:hidden; margin:6px 0 4px; }
.tk-bar i { display:block; height:100%; border-radius:4px; }
.tk-bar i.up { background:#39b970; } .tk-bar i.down { background:#e06a6a; }
.tk-sec { margin-bottom:14px; }
.tk-sec-t { font-size:18px; font-weight:800; color:var(--accent); margin:8px 0 12px; padding-bottom:5px; border-bottom:1px solid var(--line); }
.tk-charts { display:grid; grid-template-columns:repeat(auto-fill,minmax(480px,1fr)); gap:18px; }
.tk-chart-card { border:1px solid var(--line); border-radius:10px; padding:14px 16px; background:#fff; }
.tk-chart-title { font-size:15px; font-weight:600; color:var(--ink); display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.tk-dot { width:11px; height:11px; border-radius:50%; display:inline-block; }
.tk-chart-avg { margin-left:auto; font-size:13px; color:var(--muted); font-weight:500; }
.tk-linechart { width:100%; height:auto; }
.seg-tabs { display:flex; gap:6px; margin-bottom:10px; flex-wrap:wrap; }
.seg-tab { font-size:12px; padding:5px 12px; border:1px solid var(--line); background:#fbfcfe; border-radius:20px; cursor:pointer; color:var(--muted); }
.seg-tab.active { background:var(--accent); border-color:var(--accent); color:#fff; font-weight:600; }
.tk-pt { cursor:pointer; }
.tk-tip { position:absolute; z-index:60; background:#1f2430; color:#fff; padding:5px 10px; border-radius:8px; font-size:12px; pointer-events:none; box-shadow:0 4px 14px rgba(20,26,38,.28); white-space:nowrap; }
.tk-tip .tk-tip-d { color:#c7cede; margin-right:7px; }
.tk-tip b { font-size:13px; }
.tk-tip .tk-tip-bc { margin-left:7px; color:#ffd27a; font-size:11px; }

/* ── 配信マーカー（配信メーカー連携：数値が動いた日に📣）── */
.bc-mark{ display:inline-flex; align-items:center; font-size:11px; font-weight:800; color:#c23718;
  background:#fdeae4; border:1px solid #f7cdbf; border-radius:20px; padding:0 6px; margin-left:6px;
  cursor:pointer; vertical-align:middle; line-height:1.6; }
.bc-mark:hover{ background:#fbd9cf; }
.bc-pop{ position:absolute; z-index:9999; width:320px; max-width:88vw; background:#fff;
  border:1px solid #e4e8ef; border-radius:12px; box-shadow:0 10px 34px rgba(30,50,70,.22); padding:10px 12px; font-size:12px; }
.bc-pop-h{ font-weight:800; color:#3a7fa0; margin-bottom:7px; }
.bc-pop-row{ padding:6px 0; border-top:1px solid #f0f3f6; line-height:1.5; }
.bc-pop-row:first-of-type{ border-top:none; }
.bc-pop-t{ color:#94748a; font-size:11px; margin-top:2px; }
.bc-badge{ font-size:10px; font-weight:800; padding:1px 7px; border-radius:20px; }
.bc-badge.sent{ background:#dcfce7; color:#15803d; }
.bc-badge.planned{ background:#fef3c7; color:#92400e; }

/* ── 配信ログ（折りたたみ・新しい順・スクロール枠） ── */
.bc-log-head{ display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.bc-log-sub{ font-size:12px; color:var(--muted); font-weight:700; }
.bc-log-toggle{ margin-left:auto; border:1px solid #cddbe6; background:#eef4f8; color:#3a7fa0; font-size:12px; font-weight:700; padding:4px 12px; border-radius:8px; cursor:pointer; }
.bc-log-toggle:hover{ background:#e0ecf4; }
.bc-log-list{ max-height:340px; overflow:auto; border:1px solid var(--line); border-radius:10px; }
.bc-day{ border-bottom:1px solid var(--line); }
.bc-day:last-child{ border-bottom:none; }
.bc-date{ display:flex; align-items:center; gap:6px; padding:8px 12px; cursor:pointer; font-weight:700; font-size:13px; color:var(--ink); user-select:none; background:#f7fafc; }
.bc-date:hover{ background:#eef4f8; }
.bc-chev{ width:14px; color:#7d93a8; font-size:11px; }
.bc-count{ font-size:11px; font-weight:800; color:#3a7fa0; background:#e7eef8; border-radius:20px; padding:1px 9px; }
.bc-item{ display:flex; flex-direction:column; gap:4px; padding:7px 12px 8px 32px; font-size:12px; border-top:1px dashed var(--line); }
.bc-item-top{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.bc-seg{ font-weight:700; color:#2f4a5a; }
.bc-title{ color:var(--ink); }
.bc-target{ color:var(--muted); font-size:11px; }
.bc-edit{ margin-left:auto; border:1px solid #cddbe6; background:#fff; color:#3a7fa0; font-size:11px; font-weight:700; padding:2px 9px; border-radius:7px; cursor:pointer; white-space:nowrap; }
.bc-edit:hover{ background:#eef4f8; }
/* 配信→影響KPIタグ */
.bc-kpis{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; padding-left:2px; }
.bc-arrow{ font-size:11px; font-weight:700; color:#7d93a8; }
.bc-kpi{ font-size:13px; font-weight:700; color:#1f5f7a; background:#e0eef5; border:1px solid #c4dded; border-radius:20px; padding:2px 11px; }
.bc-kpi.none{ color:#9aa3af; background:#f1f3f6; border-color:#e2e6ec; font-weight:600; }
.bc-ovtag{ font-size:10px; font-weight:800; color:#92400e; background:#fef3c7; border-radius:20px; padding:1px 7px; }
/* KPIカードの関連配信 */
.tk-card-bc{ margin-top:8px; padding-top:7px; border-top:1px dashed var(--line); display:flex; flex-direction:column; gap:3px; }
.tk-card-bc-h{ font-size:14px; font-weight:800; color:#7d93a8; }
.tk-card-bc-i{ font-size:14px; color:#2f4a5a; display:flex; justify-content:space-between; gap:6px; }
.tk-bc-d{ color:#9aa3af; font-weight:700; }
/* 配信→影響KPI 編集ポップオーバー */
.bc-editor{ position:absolute; z-index:60; width:320px; background:#fff; border:1px solid #cbd5e1; border-radius:10px; box-shadow:0 12px 40px rgba(0,0,0,.22); overflow:hidden; }
.bc-ed-h{ padding:10px 12px; font-weight:800; font-size:13px; color:var(--ink); border-bottom:1px solid var(--line); background:#f7fafc; }
.bc-ed-sub{ font-weight:600; font-size:11px; color:var(--muted); margin-top:2px; }
.bc-ed-list{ max-height:280px; overflow:auto; padding:6px 4px; }
.bc-ed-item{ display:flex; align-items:center; gap:8px; padding:5px 10px; font-size:12px; cursor:pointer; border-radius:6px; }
.bc-ed-item:hover{ background:#eef4f8; }
.bc-ed-foot{ display:flex; justify-content:space-between; gap:8px; padding:9px 12px; border-top:1px solid var(--line); }
.bc-ed-foot button{ border:1px solid #cddbe6; border-radius:8px; padding:5px 12px; font-size:12px; font-weight:700; cursor:pointer; }
.bc-ed-auto{ background:#f1f3f6; color:#5a6b7a; }
.bc-ed-save{ background:#06c755; color:#fff; border-color:#06c755!important; }
.bc-ed-save:hover{ background:#05a648; }

/* ── 人物検索の絞り込みバー ── */
.pf-bar{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin:2px 0 14px; padding:10px 14px;
  background:#eef4f8; border:1px solid #d8e6ee; border-radius:12px; font-size:12.5px; position:sticky; top:0; z-index:5; }
.pf-bar label{ font-weight:700; color:#3a7fa0; display:flex; align-items:center; gap:5px; }
.pf-bar select{ padding:5px 8px; border-radius:8px; border:1px solid #cddbe6; font-size:12.5px; background:#fff; }
.pf-count{ font-weight:800; color:#2f4a5a; }

.buy-yes { color:#1f6e43; font-weight:800; }   /* この予約で購入=○（緑） */

/* ── 月次比較テーブル（月×月の差分を一覧で） ── */
.tk-mode-tabs{ margin:2px 0 14px; }
.tkm-table{ width:100%; border-collapse:collapse; font-size:13px; }
.tkm-table th{ text-align:left; color:#6b7280; font-weight:700; font-size:11.5px; padding:7px 12px; border-bottom:2px solid #e5e7eb; white-space:nowrap; }
.tkm-table td{ padding:9px 12px; border-bottom:1px solid #eef1f6; white-space:nowrap; vertical-align:middle; }
.tkm-table tr.tkm-r:hover td{ background:#f7fafc; }
.tkm-table th.tkm-num, .tkm-table td.tkm-num{ text-align:right; }
.tkm-kpi{ font-weight:700; color:#2f3a44; }
.tkm-num{ font-variant-numeric:tabular-nums; font-weight:700; color:#2f3a44; }
.tkm-comp{ color:#111; }
.tkm-arrow{ color:#b3bcc6; text-align:center; }
.tkm-delta{ font-weight:800; font-variant-numeric:tabular-nums; }
.tkm-delta.up{ color:#2e9e6b; } .tkm-delta.down{ color:#d64545; } .tkm-delta.flat{ color:#9aa3af; }
.tkm-cnt{ color:#8a94a0; font-size:11.5px; font-variant-numeric:tabular-nums; line-height:1.4; }
.tkm-bar-wrap{ display:flex; align-items:center; width:200px; height:16px; }
.tkm-bar-h{ flex:1; display:flex; height:100%; align-items:center; }
.tkm-bar-h{ justify-content:flex-end; }          /* 左半分＝右寄せ（中央線に接する） */
.tkm-bar-h.r{ justify-content:flex-start; }       /* 右半分＝左寄せ */
.tkm-bar-c{ width:1px; background:#cbd5e1; height:100%; }
.tkm-bar-h i{ height:9px; border-radius:3px; display:block; }
.tkm-bar-h i.down{ background:#e8817a; }
.tkm-bar-h i.up{ background:#5cbf93; }
