/* Notion風デザインシステム */
:root {
  --text: #37352f;
  --text-light: #787774;
  --text-faint: #9b9a97;
  --bg: #ffffff;
  --divider: #e9e9e7;
  --hover: rgba(55, 53, 47, 0.06);
  --callout-gray: #f1f1ef;
  --callout-brown: #f4eeee;
  --heading-orange: #faebdd;
  --blue-btn: #2383e2;
  /* タグ背景 */
  --tag-gray: #e3e2e0;
  --tag-blue: #d3e5ef;
  --tag-yellow: #fdecc8;
  --tag-green: #dbeddb;
  --tag-purple: #e8deee;
  --tag-pink: #f5e0e9;
  --tag-red: #ffe2dd;
  --tag-orange: #fadec9;
  --tag-brown: #eee0da;
  /* ドット(人アイコン) */
  --dot-orange: #d9730d;
  --dot-blue: #337ea9;
  --dot-brown: #9f6b53;
  --dot-yellow: #cb912f;
  --dot-green: #448361;
  --dot-purple: #9065b0;
  --dot-red: #d44c47;
  --dot-navy: #28456c;
  --dot-gray: #b1b0ad;
  --dot-black: #191919;
  --dot-white: #e3e2e0;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; }

/* ---------- 上部バー ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 12px;
  background: var(--bg);
  font-size: 14px;
}
.topbar .crumb { display: flex; align-items: center; gap: 6px; color: var(--text); }
.topbar .crumb .icon { font-size: 16px; }
.topbar .spacer { flex: 1; }
.topbar .tb-btn {
  border: none; background: none; padding: 4px 8px; border-radius: 4px;
  color: var(--text); cursor: pointer; font-size: 14px;
}
.topbar .tb-btn:hover { background: var(--hover); }

/* ---------- カバー・タイトル ---------- */
.cover { height: 220px; background: #4d94b8; background-image: linear-gradient(180deg, #4d94b8, #3f86ab); }
.page {
  max-width: 1500px;               /* 画面が広い端末では広く使う */
  margin: 0 auto;
  padding: 0 clamp(16px, 5vw, 96px) 30vh;
}
.gcard { text-decoration: none; color: inherit; display: block; }

/* 営業ボードへの入口バナー */
.board-banner {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #2383e2, #1b6cbe);
  color: #fff; border-radius: 10px; padding: 16px 20px;
  text-decoration: none; margin: 12px 0 18px;
  box-shadow: 0 2px 10px rgba(35, 131, 226, .35);
  transition: transform .1s, box-shadow .1s;
}
.board-banner:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(35, 131, 226, .45); }
.bb-icon { font-size: 30px; line-height: 1; }
.bb-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bb-title { font-size: 18px; font-weight: 700; }
.bb-sub { font-size: 13px; opacity: .92; }
.bb-arrow { margin-left: auto; font-size: 28px; opacity: .85; }
@media (max-width: 640px) {
  .board-banner { padding: 14px 16px; gap: 10px; }
  .bb-title { font-size: 16px; }
  .bb-sub { font-size: 12px; }
}

/* 実績ページのサマリー */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.stat {
  border: 1px solid var(--divider); border-radius: 8px; padding: 10px 14px;
  background: #fff; box-shadow: 0 1px 2px rgba(15,15,15,.03);
}
.stat-l { font-size: 12px; color: var(--text-light); }
.stat-v { font-size: 20px; font-weight: 700; margin-top: 2px; }
.page-icon {
  width: 100px; height: 100px; margin-top: -54px;
  background: #fff; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1px rgba(15,15,15,.06);
}
.page-icon img { width: 84px; height: 84px; object-fit: contain; }
h1.page-title {
  font-size: 40px; font-weight: 700; margin: 24px 0 8px; line-height: 1.2;
  letter-spacing: .01em;
}

/* ---------- 汎用ブロック ---------- */
.callout {
  display: flex; gap: 8px; padding: 16px 16px 16px 12px;
  border-radius: 4px; margin: 6px 0;
}
.callout .callout-icon { font-size: 16px; line-height: 1.4; flex-shrink: 0; }
.callout.gray { background: var(--callout-gray); }
.callout.brown { background: var(--callout-brown); }
.callout.plain { background: transparent; border: 1px solid var(--divider); }
.callout-body { flex: 1; min-width: 0; }

.h-band {
  background: var(--heading-orange);
  padding: 3px 6px; border-radius: 4px;
  font-size: 17px; font-weight: 600;
  margin: 24px 0 8px;
}
h2.toggle-h {
  font-size: 22px; font-weight: 600; margin: 12px 0 4px;
  display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none;
}
h3.sub-h { font-size: 17px; font-weight: 600; margin: 14px 0 4px; display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.tri {
  width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .15s; font-size: 11px; color: var(--text);
}
.toggle-h:hover .tri, .sub-h:hover .tri { background: var(--hover); }
.tg[open] > summary .tri { transform: rotate(90deg); }
.tg > summary { list-style: none; }
.tg > summary::-webkit-details-marker { display: none; }

.columns { display: flex; gap: 28px; }
.columns > .col { min-width: 0; }

/* ---------- ギャラリービュー ---------- */
.db-block { margin: 8px 0 20px; }
.db-header {
  display: flex; align-items: center; gap: 6px; padding: 4px 0;
  border-bottom: 1px solid var(--divider); margin-bottom: 12px;
}
.db-header .db-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.db-header .lock { color: var(--text-faint); font-size: 12px; display: flex; align-items: center; gap: 3px; }
.db-header .spacer { flex: 1; }
.db-header .hicons { color: var(--text-faint); display: flex; gap: 10px; font-size: 13px; align-items: center; }
.btn-new {
  background: var(--blue-btn); color: #fff; border: none; border-radius: 4px;
  font-size: 13px; padding: 4px 8px; cursor: pointer; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-new:hover { background: #1a74cc; }

.gallery { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.gcard {
  border: 1px solid var(--divider); border-radius: 6px; overflow: hidden;
  background: #fff; cursor: pointer;
  box-shadow: 0 1px 2px rgba(15,15,15,.03);
}
.gcard:hover { background: #fafafa; }
.gcard .gimg {
  height: 110px; display: flex; align-items: center; justify-content: center;
  background: #fff; border-bottom: 1px solid var(--divider);
}
.gcard .gbody { padding: 8px 10px; font-size: 14px; }
.gcard .gsub { font-size: 12px; color: var(--text-light); display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.gcard .gname { display: flex; align-items: center; gap: 6px; font-weight: 500; }

.store-logo {
  width: 84px; height: 84px; border-radius: 50%;
  border: 4px solid; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px; letter-spacing: .05em;
  color: #333; position: relative; text-align: center; line-height: 1.1;
}
.avatar {
  width: 100%; height: 110px; object-fit: cover; object-position: top;
}
.avatar-ph {
  width: 74px; height: 74px; border-radius: 50%;
  background: #e8e8e6; color: #a5a29e;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 600;
}
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex-shrink: 0; border: 1px solid rgba(0,0,0,.15); background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.7), rgba(255,255,255,0) 45%); }
.dot.orange { background-color: var(--dot-orange); }
.dot.blue { background-color: var(--dot-blue); }
.dot.brown { background-color: var(--dot-brown); }
.dot.yellow { background-color: var(--dot-yellow); }
.dot.green { background-color: var(--dot-green); }
.dot.purple { background-color: var(--dot-purple); }
.dot.red { background-color: var(--dot-red); }
.dot.navy { background-color: var(--dot-navy); }
.dot.gray { background-color: var(--dot-gray); }
.dot.black { background-color: var(--dot-black); }
.dot.white { background-color: var(--dot-white); }

.page-ref { display: inline-flex; align-items: center; gap: 4px; }
.page-ref .pg { color: var(--text-faint); }

/* ---------- リンク集 ---------- */
.dblinks { display: grid; grid-template-columns: 1fr 1.2fr; gap: 4px 24px; }
.dblink {
  display: flex; align-items: center; gap: 8px; padding: 3px 4px;
  border-radius: 4px; text-decoration: none; font-weight: 500;
}
.dblink:hover { background: var(--hover); }
.dblink .di { color: var(--text-faint); }
.dblink span.t { border-bottom: 1px solid #d5d3d0; }

/* ---------- チャート ---------- */
.chart-block { margin: 4px 0 16px; }
.chart-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.chart-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--callout-gray); border-radius: 14px; padding: 3px 10px;
  font-size: 13px; font-weight: 500;
}
.chart-head .spacer { flex: 1; }
.chart-head .hicons { color: var(--text-faint); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.hchart { position: relative; }
.hchart .hbar-row { position: relative; z-index: 1; }
.hgrid { position: absolute; top: 0; bottom: 18px; left: 98px; right: 60px; z-index: 0; pointer-events: none; }
.hgrid-line { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(55, 53, 47, .08); }
.haxis { position: relative; z-index: 1; height: 18px; margin: 4px 60px 0 98px; }
.haxis-l { position: absolute; transform: translateX(-50%); font-size: 10.5px; color: var(--text-faint); white-space: nowrap; }
.hchart .hbar-track { margin-right: 60px; }
.hchart .hbar { flex-shrink: 0; }
.hbar-row { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 8px; margin: 14px 0; }
.hbar-label { font-size: 12px; color: var(--text); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { display: flex; align-items: center; gap: 6px; }
.hbar { height: 20px; border-radius: 2px; min-width: 2px; }
.hbar-val { font-size: 12px; color: var(--text-light); white-space: nowrap; }
.donut-wrap { display: flex; flex-direction: column; align-items: center; padding: 12px 0 20px; }
.donut { position: relative; }
.donut .center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.donut .center .num { font-size: 44px; font-weight: 700; }
.donut .center .lbl { font-size: 12px; color: var(--text-light); }

/* ---------- カンバン ---------- */
.board-tabs { display: flex; align-items: center; gap: 4px; margin: 4px 0 8px; }
.board-tab {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 4px; font-size: 14px;
  color: var(--text-light); cursor: pointer; border: none; background: none;
}
.board-tab.active { background: var(--callout-gray); color: var(--text); font-weight: 500; }
.board-tab:hover { background: var(--hover); }
.board-toolbar { display: flex; align-items: center; gap: 10px; color: var(--text-faint); }

.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.bcol { width: 260px; flex-shrink: 0; border-radius: 8px; padding: 6px; }
.bcol .bcol-head {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 8px;
  font-size: 15px;
}
.bcol .pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 15px;
  border-radius: 14px; padding: 2px 12px 2px 9px; font-weight: 600;
}
.pill .pdot { width: 8px; height: 8px; border-radius: 50%; }
.bcol .cnt { color: var(--text-faint); font-size: 14px; }
.bcol.blue { background: #f6fafd; } .bcol.blue .pill { background: var(--tag-blue); } .pill .pdot.blue { background: var(--dot-blue); }
.bcol.yellow { background: #fdfaf3; } .bcol.yellow .pill { background: var(--tag-yellow); } .pill .pdot.yellow { background: var(--dot-yellow); }
.bcol.green { background: #f6faf6; } .bcol.green .pill { background: var(--tag-green); } .pill .pdot.green { background: var(--dot-green); }
.bcol.purple { background: #faf8fc; } .bcol.purple .pill { background: var(--tag-purple); } .pill .pdot.purple { background: var(--dot-purple); }
.bcol.pink { background: #fdf8fa; } .bcol.pink .pill { background: var(--tag-pink); } .pill .pdot.pink { background: #c14c8a; }
.bcol.red { background: #fdf7f6; } .bcol.red .pill { background: var(--tag-red); } .pill .pdot.red { background: var(--dot-red); }

.bcard {
  background: #fff; border-radius: 6px; padding: 8px 10px; margin: 6px 0;
  box-shadow: 0 0 0 1px rgba(15,15,15,.05), 0 1px 2px rgba(15,15,15,.04);
  cursor: pointer; font-size: 13px;
}
.bcard:hover { background: #fbfbfa; }
.bcard.dragging { opacity: .45; }
.bcol.drag-over { outline: 2px dashed var(--blue-btn); outline-offset: -2px; }
.bcard .bname { font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.bcard .brow { display: flex; align-items: center; gap: 5px; margin: 5px 0; color: var(--text); }
.bcard .brow .dot { width: 12px; height: 12px; }
.bcard .brow.money { color: var(--text); }
.tag {
  display: inline-block; padding: 0 6px; border-radius: 3px;
  font-size: 12px; line-height: 1.6;
}
.tag.a { background: var(--tag-red); }
.tag.b { background: var(--tag-yellow); }
.tag.c { background: var(--tag-blue); }
.tag.none { background: var(--tag-gray); }
.bcol .add-card {
  display: flex; align-items: center; gap: 6px; color: var(--text-faint);
  padding: 6px; cursor: pointer; border-radius: 4px; font-size: 13px;
}
.bcol .add-card:hover { background: var(--hover); }

/* ---------- テーブルビュー ---------- */
.tbl-wrap { overflow-x: auto; margin: 6px 0 10px; }
table.ntable { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.ntable th, .ntable td {
  border-top: 1px solid var(--divider);
  padding: 5px 8px; text-align: left; white-space: nowrap; max-width: 320px;
  overflow: hidden; text-overflow: ellipsis;
}
.ntable tr:last-child td { border-bottom: 1px solid var(--divider); }
.ntable th {
  color: var(--text-light); font-weight: 400; font-size: 13px;
  border-top: none;
}
.ntable th .thi { margin-right: 4px; color: var(--text-faint); }
.ntable td.link-cell { cursor: pointer; }
.ntable td.link-cell:hover { background: var(--hover); }
tr.row-click { cursor: pointer; }
tr.row-click:hover td { background: var(--hover); }
.ntable .count-row { color: var(--text-faint); font-size: 12px; padding: 4px 8px; }
.status-tag { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border-radius: 12px; font-size: 13px; }
.status-tag .sdot { width: 8px; height: 8px; border-radius: 50%; }
.status-tag.gray { background: var(--tag-gray); } .status-tag.gray .sdot { background: #787774; }
.status-tag.green { background: var(--tag-green); } .status-tag.green .sdot { background: var(--dot-green); }
.status-tag.blue { background: var(--tag-blue); } .status-tag.blue .sdot { background: var(--dot-blue); }
.status-tag.red { background: var(--tag-red); } .status-tag.red .sdot { background: var(--dot-red); }

/* ---------- モーダル(案件詳細) ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,15,15,.6); z-index: 100;
  display: none; align-items: flex-start; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 10px; margin-top: 60px;
  width: min(860px, calc(100vw - 80px)); max-height: calc(100vh - 120px);
  overflow-y: auto; box-shadow: 0 8px 30px rgba(15,15,15,.25);
  padding: 44px 90px 60px;
}
.modal h1.m-title {
  font-size: 32px; font-weight: 700; margin: 0 0 12px; outline: none;
}
.m-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.m-tab {
  display: inline-flex; align-items: center; gap: 5px; font-size: 14px;
  padding: 3px 8px; border-radius: 4px; border: 1px solid var(--divider);
  background: none; cursor: pointer; color: var(--text-light);
}
.m-tab.active { background: var(--callout-gray); color: var(--text); border-color: transparent; font-weight: 500; }
.m-sec { color: var(--text-faint); font-size: 13px; margin: 18px 0 4px; }
.prop-row { display: flex; align-items: flex-start; min-height: 32px; }
.prop-label {
  width: 160px; flex-shrink: 0; color: var(--text-light); font-size: 14px;
  display: flex; align-items: center; gap: 6px; padding: 5px 0;
}
.prop-label .pi { color: var(--text-faint); width: 16px; text-align: center; }
.prop-value { flex: 1; padding: 3px 6px; border-radius: 4px; min-height: 26px; }
.prop-value:hover { background: var(--hover); }
select.nsel {
  appearance: none; -webkit-appearance: none;
  width: auto; max-width: 100%;
  padding: 3px 12px; border-radius: 8px; font-size: 13px; line-height: 1.6;
  border: none; outline: none; cursor: pointer; color: var(--text);
  transition: box-shadow .1s;
}
select.nsel:hover { box-shadow: 0 0 0 2px rgba(55, 53, 47, .08); }
select.nsel:focus { box-shadow: 0 0 0 2px rgba(35, 131, 226, .3); }
.tagc-none, select.nsel.tagc-none { background: transparent; }
.tagc-gray, select.nsel.tagc-gray { background: var(--tag-gray); }
.tagc-blue, select.nsel.tagc-blue { background: var(--tag-blue); }
.tagc-yellow, select.nsel.tagc-yellow { background: var(--tag-yellow); }
.tagc-green, select.nsel.tagc-green { background: var(--tag-green); }
.tagc-purple, select.nsel.tagc-purple { background: var(--tag-purple); }
.tagc-pink, select.nsel.tagc-pink { background: var(--tag-pink); }
.tagc-red, select.nsel.tagc-red { background: var(--tag-red); }
.tagc-orange, select.nsel.tagc-orange { background: var(--tag-orange); }
.tagc-brown, select.nsel.tagc-brown { background: var(--tag-brown); }
.prop-value input, .prop-value select, .prop-value textarea {
  width: 100%; border: none; background: transparent; font: inherit; color: inherit;
  outline: none; padding: 2px 0; resize: vertical;
}
.prop-value .empty { color: var(--text-faint); }
.m-close {
  position: sticky; top: 0; float: right; margin: -30px -70px 0 0;
  background: none; border: none; font-size: 18px; color: var(--text-faint);
  cursor: pointer; padding: 6px; border-radius: 4px;
}
.m-close:hover { background: var(--hover); }

/* ---------- ボタン風リンク ---------- */
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--divider); border-radius: 6px;
  padding: 4px 10px; font-size: 14px; font-weight: 500; text-decoration: none;
  box-shadow: 0 1px 2px rgba(15,15,15,.05); cursor: pointer;
}
.pill-btn:hover { background: #fafafa; }

.empty-hint { color: var(--text-faint); font-size: 13px; padding: 8px 0; }

/* ---------- 月カレンダー ---------- */
.cal-toolbar { display: flex; gap: 8px; align-items: center; margin: 8px 0 10px; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--divider); border-left: 1px solid var(--divider);
}
.cal-dow {
  text-align: center; font-size: 12px; color: var(--text-light); padding: 5px 0;
  border-right: 1px solid var(--divider); border-bottom: 1px solid var(--divider);
  background: #fbfbfa;
}
.cal-cell {
  min-height: 96px; padding: 4px; font-size: 12px; overflow: hidden;
  border-right: 1px solid var(--divider); border-bottom: 1px solid var(--divider);
}
.cal-cell.other { background: #fafaf9; }
.cal-cell[data-date] { cursor: pointer; }
.cal-cell[data-date]:hover { background: #fbfbfa; }
.cal-day { font-size: 12px; color: var(--text-light); width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; margin-bottom: 2px; }
.cal-cell.today .cal-day { background: var(--dot-red); color: #fff; border-radius: 50%; font-weight: 600; }
.cal-ev {
  display: flex; gap: 4px; align-items: center; padding: 1px 3px; border-radius: 3px;
  cursor: pointer; margin-bottom: 1px;
}
.cal-ev:hover { background: var(--hover); }
.cal-ev .dot { width: 8px; height: 8px; flex-shrink: 0; }
.cal-ev-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { color: var(--text-faint); font-size: 11px; padding-left: 3px; cursor: default; }
@media (max-width: 640px) {
  .cal-cell { min-height: 64px; padding: 2px; }
  .cal-ev { padding: 1px 2px; }
  .cal-ev-t { font-size: 10px; }
}

/* ログ入力フォームとオートコンプリート */
.log-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; align-items: center; }
.log-form input, .log-form select {
  font: inherit; padding: 7px 10px; border: 1px solid var(--divider); border-radius: 6px; background: #fff;
}
.log-form input:focus, .log-form select:focus { outline: 2px solid rgba(35,131,226,.4); border-color: var(--blue-btn); }
.ac-wrap { position: relative; }
.ac-wrap input { width: 100%; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 60;
  background: #fff; border: 1px solid var(--divider); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(15,15,15,.12); max-height: 260px; overflow-y: auto;
}
.ac-item { padding: 7px 12px; cursor: pointer; display: flex; gap: 8px; align-items: center; font-size: 14px; }
.ac-item:hover, .ac-item.sel { background: var(--callout-gray); }
.ac-item .ac-sub { color: var(--text-faint); font-size: 12px; margin-left: auto; }
@media (max-width: 640px) {
  .log-form { flex-direction: column; align-items: stretch; }
  .log-form input, .log-form select { font-size: 16px; }
}

/* データベース一覧の色付きタグ */
.ntag {
  display: inline-block; padding: 0 8px; border-radius: 12px;
  font-size: 13px; line-height: 1.7; white-space: nowrap;
}
select.nsel-e {
  appearance: none; -webkit-appearance: none;
  width: auto !important; max-width: 100%;
  padding: 4px 12px !important; border-radius: 12px !important;
  border: none !important; cursor: pointer;
  background: var(--callout-gray);
}
.nc-field select.nsel-e.tagc-gray { background: var(--tag-gray); }
.nc-field select.nsel-e.tagc-blue { background: var(--tag-blue); }
.nc-field select.nsel-e.tagc-yellow { background: var(--tag-yellow); }
.nc-field select.nsel-e.tagc-green { background: var(--tag-green); }
.nc-field select.nsel-e.tagc-purple { background: var(--tag-purple); }
.nc-field select.nsel-e.tagc-pink { background: var(--tag-pink); }
.nc-field select.nsel-e.tagc-red { background: var(--tag-red); }
.nc-field select.nsel-e.tagc-orange { background: var(--tag-orange); }
.nc-field select.nsel-e.tagc-brown { background: var(--tag-brown); }

/* 案件追加フォーム */
.nc-modal { width: min(560px, calc(100vw - 40px)); padding: 28px 30px 24px; margin-top: 90px; max-height: calc(100vh - 140px); }
.nc-field { margin-bottom: 12px; flex: 1; min-width: 0; }
.nc-field label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 4px; }
.nc-field label .req { color: #d44c47; font-size: 11px; margin-left: 4px; }
.nc-field input, .nc-field select, .nc-field textarea {
  width: 100%; font: inherit; padding: 7px 10px;
  border: 1px solid var(--divider); border-radius: 6px; background: #fff;
  resize: vertical;
}
.nc-field input:focus, .nc-field select:focus, .nc-field textarea:focus {
  outline: 2px solid rgba(35, 131, 226, .4); border-color: var(--blue-btn);
}
.nc-row { display: flex; gap: 10px; }
@media (max-width: 640px) {
  .nc-modal { width: 100vw; margin: 0; max-height: 100dvh; height: 100dvh; border-radius: 0; padding: 20px 16px 40px; }
  .nc-row { flex-direction: column; gap: 0; }
  .nc-field input, .nc-field select, .nc-field textarea { font-size: 16px; padding: 10px; }
}
@media (max-width: 900px) {
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .columns { flex-direction: column; gap: 8px; }
}

/* ---------- スマホ最適化 ---------- */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .topbar { height: auto; min-height: 44px; flex-wrap: wrap; padding: 6px 10px; gap: 4px; }
  .topbar .crumb { max-width: 46vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
  .topbar .tb-btn { padding: 6px; font-size: 13px; }
  .cover { height: 110px; }
  .page { padding: 0 14px 15vh; }
  .page-icon { width: 68px; height: 68px; margin-top: -36px; }
  .page-icon img { width: 56px; height: 56px; }
  h1.page-title { font-size: 26px; margin: 14px 0 6px; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .gcard .gimg { height: 92px; }
  .store-logo { width: 68px; height: 68px; font-size: 17px; }
  .h-band { font-size: 15px; }
  h2.toggle-h { font-size: 19px; }

  /* カンバン: 列を細くして横スクロール */
  .board { gap: 8px; -webkit-overflow-scrolling: touch; }
  .bcol { width: 210px; }
  .bcard { padding: 10px 12px; }

  /* テーブルは横スクロール(既定) + 行を触りやすく */
  .ntable th, .ntable td { padding: 8px 8px; }

  /* 案件詳細モーダル: 全画面 */
  .modal-overlay.open { align-items: stretch; }
  .modal {
    width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0;
    border-radius: 0; padding: 20px 16px 80px;
  }
  .modal h1.m-title { font-size: 24px; }
  .m-close { position: fixed; top: 8px; right: 8px; margin: 0; background: var(--callout-gray); border-radius: 50%; width: 34px; height: 34px; }
  .prop-row { min-height: 40px; }
  .prop-label { width: 118px; font-size: 13px; }
  .prop-value { padding: 6px 8px; }
  /* iOSの自動ズームを防ぐため入力は16px */
  .prop-value input, .prop-value select, .prop-value textarea,
  #log-form input, #log-form select { font-size: 16px; }
  #log-form { flex-direction: column; align-items: stretch; }
  #log-form input, #log-form select { padding: 9px 10px; }
  .btn-new { padding: 8px 12px; font-size: 15px; }
  .pill-btn { padding: 8px 12px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat-v { font-size: 17px; }
  .dblinks { grid-template-columns: 1fr; }
}

/* ---------- 入力式の絞り込みセレクト(コンボボックス) ---------- */
.combo { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; }
.combo-input {
  flex: 1; min-width: 0; font: inherit; padding: 6px 10px;
  border: 1px solid var(--divider); border-radius: 6px; background: #fff;
}
.combo-input:focus { outline: 2px solid rgba(35, 131, 226, .35); border-color: var(--blue-btn); }
.combo-clear {
  border: none; background: none; color: var(--text-faint); cursor: pointer;
  font-size: 12px; padding: 4px; flex-shrink: 0;
}
.combo-clear:hover { color: var(--text); }
.combo-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 300;
  background: #fff; border: 1px solid var(--divider); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 15, 15, .15); max-height: 260px; overflow-y: auto;
}
.combo-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  cursor: pointer; font-size: 14px;
}
.combo-item:hover, .combo-item.active { background: var(--hover); }
.combo-item .dot { width: 12px; height: 12px; }
.combo-more { padding: 8px 12px; color: var(--text-faint); font-size: 12px; }
@media (max-width: 640px) {
  .combo-input { font-size: 16px; padding: 10px; }
  .combo-item { padding: 11px 12px; }
}

/* ---------- 折りたたみ式サイドバー ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px;
  background: #f7f6f4; border-right: 1px solid var(--divider);
  z-index: 90; overflow-y: auto; padding: 12px 8px 24px;
  transform: translateX(0); transition: transform .18s ease;
}
body.sb-closed .sidebar { transform: translateX(-105%); }
body { transition: padding-left .18s ease; }
body:not(.sb-closed) { padding-left: 240px; }
.sb-head { display: flex; gap: 10px; align-items: center; padding: 6px 10px 14px; }
.sb-head img { width: 32px; height: 32px; flex-shrink: 0; }
.sb-title { font-weight: 700; font-size: 14px; }
.sb-user { font-size: 12px; color: var(--text-light); }
.sb-nav a, .sb-nav button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border-radius: 6px; text-decoration: none;
  color: var(--text); font-size: 14px; border: none; background: none;
  cursor: pointer; text-align: left; font-family: inherit;
}
.sb-nav a:hover, .sb-nav button:hover { background: var(--hover); }
.sb-sec summary {
  padding: 7px 10px; font-size: 12px; color: var(--text-light);
  cursor: pointer; list-style: none; border-radius: 6px; user-select: none;
}
.sb-sec summary::-webkit-details-marker { display: none; }
.sb-sec summary:hover { background: var(--hover); }
.sb-sec a { padding-left: 24px; font-size: 13.5px; }
.sb-backdrop { display: none; }
@media (max-width: 900px) {
  body:not(.sb-closed) { padding-left: 0; }
  body:not(.sb-closed) .sb-backdrop {
    display: block; position: fixed; inset: 0;
    background: rgba(15, 15, 15, .4); z-index: 85;
  }
  .sidebar { width: 270px; box-shadow: 4px 0 20px rgba(15,15,15,.15); }
}

/* ---------- 案件詳細: 段階・スケジュール・経過メモ ---------- */
.cs-stage-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; flex-wrap: wrap; }
.stage-hist summary { font-size: 12.5px; color: var(--text-light); cursor: pointer; list-style: none; padding: 3px 8px; border-radius: 4px; }
.stage-hist summary::-webkit-details-marker { display: none; }
.stage-hist summary:hover { background: var(--hover); }
.stage-hist-list { padding: 6px 4px; font-size: 13px; }
.sh-item { padding: 3px 4px; }
.ntag { display: inline-block; padding: 0 8px; border-radius: 3px; font-size: 12.5px; line-height: 1.7; }
.note-form { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin: 4px 0 8px; }
.note-form select { flex: 0 0 auto; }
.note-form textarea { flex: 1; min-width: 200px; font: inherit; padding: 8px 10px; border: 1px solid var(--divider); border-radius: 6px; resize: vertical; }
.note-item { border: 1px solid var(--divider); border-radius: 6px; margin: 5px 0; background: #fff; overflow: hidden; }
.note-head { display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; min-width: 0; }
.note-head:hover { background: var(--hover); }
.note-meta { color: var(--text-faint); font-size: 12px; flex-shrink: 0; }
.note-preview { color: var(--text-light); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.note-full { padding: 8px 12px 12px; border-top: 1px solid var(--divider); font-size: 13.5px; background: #fbfbfa; }
.cs-mini { padding: 2px 8px; font-size: 12px; }
.cs-scheds { margin-bottom: 4px; }
@media (max-width: 640px) {
  .note-form { flex-direction: column; align-items: stretch; }
  .note-form textarea { font-size: 16px; }
  .note-preview { display: none; }
}

/* 段階の履歴(横並びフロー: タグの下に日付、右上に✕) */
.sh-flow { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 2px; min-width: 0; }
.sh-step { display: inline-flex; flex-direction: column; align-items: center; position: relative; padding: 0 7px; }
.sh-date { font-size: 10px; color: var(--text-faint); margin-top: 2px; line-height: 1.2; }
.sh-arrow { color: var(--text-faint); margin: 3px 1px 0; font-size: 12px; }
.sh-del {
  position: absolute; top: -7px; right: -3px;
  border: none; background: var(--bg, #fff); color: var(--text-faint);
  cursor: pointer; font-size: 9px; line-height: 1; padding: 2px 3px;
  border-radius: 50%; box-shadow: 0 0 0 1px var(--divider); opacity: .8;
}
.sh-del:hover { color: #fff; background: #d44c47; opacity: 1; }

/* スケジュール: 日付タブ+1件表示 */
.sched-pager { margin: 2px 0 6px; }
.sp-row { display: flex; align-items: center; gap: 6px; }
.sp-nav { border: none; background: rgba(0,0,0,.045); border-radius: 6px; width: 26px; height: 26px; cursor: pointer; font-size: 15px; color: var(--text-light); flex-shrink: 0; }
.sp-nav:disabled { opacity: .3; cursor: default; }
.sp-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.sp-tabs::-webkit-scrollbar { display: none; }
.sp-tab { border: none; background: rgba(0,0,0,.045); border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--text-light); white-space: nowrap; flex-shrink: 0; }
.sp-tab.on { background: #e7f3f8; color: #337ea9; font-weight: 600; }
.sp-item { margin-top: 6px; padding: 8px 10px; border: 1px solid var(--divider); border-radius: 8px; font-size: 14px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sp-item[data-dbedit]:hover { background: rgba(0,0,0,.03); }

/* プロパティ: 折りたたみグループ+2列グリッド */
.pgroup { border-top: 1px solid var(--divider); padding: 2px 0 8px; }
.pgroup > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-light); padding: 9px 0 5px; user-select: none; }
.pgroup > summary::-webkit-details-marker { display: none; }
.pgroup > summary::before { content: '▸'; color: var(--text-faint); transition: transform .15s; }
.pgroup[open] > summary::before { transform: rotate(90deg); }
.pg-count { font-weight: 400; font-size: 11px; color: var(--text-faint); }
.pgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.pgrid .span2 { grid-column: 1 / -1; }
@media (max-width: 900px) { .pgrid { grid-template-columns: 1fr; } }

/* カンバンカード: 名前の左の優先度タグ */
.bcard .bname .tag { font-size: 11px; padding: 0 6px; margin-right: 3px; vertical-align: 1px; }
/* タグ型セレクトは内容幅で表示(全幅化の打ち消し) */
.prop-value select.nsel { width: auto; }

/* スケジュール: シンプルな1行リスト */
.cs-scheds { margin: 2px 0 6px; }
.sched-line { padding: 3px 8px; font-size: 13.5px; border-radius: 6px; }
.sched-line[data-dbedit] { cursor: pointer; }
.sched-line[data-dbedit]:hover { background: rgba(0,0,0,.04); }
/* タイトル直下の担当営業行 */
.cs-top-staff { margin-top: 6px; min-height: 30px; }

/* プロパティ: 左右2列(縦に読む)+中央の境界線 */
.pcols { display: flex; }
.pcol { flex: 1 1 0; min-width: 0; }
.pcol-r { border-left: 1px solid var(--divider); padding-left: 26px; margin-left: 26px; }
@media (max-width: 900px) {
  .pcols { flex-direction: column; }
  .pcol { width: 100%; }
  .pcol-r { border-left: none; padding-left: 0; margin-left: 0; }
}
/* 選択タグは他のテキストと同じ左寄せ(枠内の文字だけ中央) */
.pcol .prop-value select.nsel { text-align: center; }
/* 提案施設の編集UI */
.prop-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 0 8px; }
.prop-chips .chart-chip { display: inline-flex; align-items: center; gap: 4px; }
.chip-del { border: none; background: none; color: var(--text-faint); cursor: pointer; font-size: 10px; padding: 0 2px; border-radius: 50%; }
.chip-del:hover { color: #fff; background: #d44c47; }
.prop-add-wrap { min-width: 180px; }

/* グラフ: ホバーツールチップ+クリック可能 */
[data-chart] { cursor: pointer; }
.hbar-click:hover { background: rgba(0,0,0,.025); border-radius: 4px; }
.hbar-click:hover .hbar { filter: brightness(1.08); }
svg rect[data-chart]:hover { filter: brightness(1.1); }
.chart-tip { position: fixed; z-index: 300; background: #fff; border: 1px solid var(--divider); border-radius: 8px; box-shadow: 0 6px 22px rgba(0,0,0,.14); padding: 8px 10px; font-size: 12.5px; pointer-events: none; min-width: 180px; }
.chart-tip[hidden] { display: none; }
.ct-main { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.ct-sw { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.ct-val { margin-left: auto; color: var(--text-light); padding-left: 16px; }
.ct-hint { color: var(--text-faint); font-size: 11.5px; margin-top: 6px; border-top: 1px solid var(--divider); padding-top: 6px; }
/* グラフのデータ一覧ポップアップ */
.cr-bg { position: fixed; inset: 0; background: rgba(15,15,15,.45); z-index: 250; display: flex; align-items: flex-start; justify-content: center; padding: 9vh 16px 16px; }
.cr-bg[hidden] { display: none; }
.cr-modal { background: #fff; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.25); width: 660px; max-width: 100%; padding: 18px 20px; }
.cr-head { display: flex; align-items: center; justify-content: space-between; font-size: 17px; }
.cr-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.cr-chip { border: 1px solid var(--divider); border-radius: 20px; padding: 2px 10px; font-size: 12px; color: #337ea9; background: #f7fbfd; }
.cr-row { cursor: pointer; }
.cr-row:hover { background: rgba(0,0,0,.03); }

/* h-band型の開閉見出し */
.hband-sum { cursor: pointer; display: flex; align-items: center; gap: 6px; }
.hband-sum .tri { font-size: 11px; }
details.tg > summary:hover .h-band { filter: brightness(.97); }

/* 案件管理見出しの進行中件数バッジ */
.ongoing-badge {
  display: inline-block; background: var(--tag-blue); color: var(--text);
  border-radius: 16px; padding: 2px 12px; font-size: 15px; font-weight: 600;
  margin-right: 10px; vertical-align: 4px;
}

/* カレンダーの店舗切り替え */
.cal-stores { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.cal-store.active { background: #2383e2; color: #fff; border-color: transparent; }
.cal-store.active:hover { background: #1a75d2; }
