/* KPI・ピボット・グラフ ダッシュボードの「お試し」（2026-10-07）。
   プラグインのコードは使わず、サイト用に一から書いた縮小版。見た目は本物に合わせている */
.kd { font-family: "メイリオ", Meiryo, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 13px; color: #2d2d2d; letter-spacing: 0; background: #f4f6f8; border: 1px solid #e3e7e8; border-radius: 14px;
  padding: 14px; position: relative; box-shadow: 0 18px 48px rgba(31, 45, 61, .08); }
.kd *, .kd *::before, .kd *::after { box-sizing: border-box; }
.kd.is-full { position: fixed; inset: 0; z-index: 1000; border-radius: 0; overflow: auto; }
.kd-wide { padding: 0 4%; position: relative; z-index: 2; }

.kd-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; background: #fff; border: 1px solid #e3e7e8; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.kd-bar label { font-weight: 700; color: #34495e; font-size: 13px; }
.kd-bar select { height: 30px; border: 1px solid #d0d5d8; border-radius: 4px; padding: 0 6px; font: inherit; font-size: 13px; background: #fff; }
.kd-bar .sp { flex: 1; }
.kd-btn { height: 30px; padding: 0 14px; border-radius: 4px; border: 1px solid #3498db; background: #3498db; color: #fff; cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap; }
.kd-btn:hover { background: #2c86c4; }
.kd-btn--ghost { background: #fff; color: #3498db; }
.kd-btn--ghost:hover { background: #eaf4fb; }
.kd-btn.is-on { background: #2c3e50; border-color: #2c3e50; color: #fff; }

.kd-main { display: flex; gap: 12px; align-items: flex-start; }
.kd-grid { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 74px; gap: 8px; }
.kd-grid.is-edit { background-image: linear-gradient(rgba(52,152,219,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(52,152,219,.06) 1px, transparent 1px);
  background-size: 8.333% 82px; outline: 1px dashed #cdd8de; border-radius: 6px; }
.kd-card { background: #fff; border: 1px solid #e3e7e8; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.05); display: flex; flex-direction: column; overflow: hidden; position: relative; min-width: 0; }
.kd-card.is-editing { outline: 2px solid #3498db; }
.kd-card.is-drag { opacity: .85; z-index: 5; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.kd-card.is-over { outline: 2px dashed #3498db; }
.kd-card__head { display: flex; align-items: center; justify-content: space-between; padding: 5px 8px 5px 10px; border-bottom: 1px solid #eef2f4; font-size: 12px; font-weight: 700; color: #34495e; min-height: 30px; flex: none; }
.kd-grid.is-edit .kd-card__head { cursor: move; background: #f7fafc; }
.kd-card__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kd-tools { display: inline-flex; gap: 2px; flex: none; }
.kd-tool { border: 0; background: none; cursor: pointer; font-size: 13px; color: #7a8488; padding: 0 4px; border-radius: 3px; line-height: 1.4; }
.kd-tool:hover { background: #e8eef1; color: #2c3e50; }
.kd-tool.rm:hover { background: #fdecea; color: #c0392b; }
.kd-card__body { flex: 1; min-height: 0; overflow: hidden; position: relative; }
.kd-resize { position: absolute; right: 2px; bottom: 2px; width: 14px; height: 14px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, #b8c4c9 50%, #b8c4c9 58%, transparent 58%, transparent 70%, #b8c4c9 70%, #b8c4c9 78%, transparent 78%); }

.kd-kpi { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px; }
.kd-card { container-type: inline-size; }
/* 数字の大きさはカードの幅に合わせる（設定欄を開いてカードが狭くなっても切れない） */
.kd-kpi__value { font-size: clamp(16px, 12.5cqi, 42px); font-weight: 800; color: #2c3e50; line-height: 1.1; white-space: nowrap; max-width: 100%; }
.kd-kpi__unit { font-size: .45em; font-weight: 600; color: #7a8488; margin-left: 3px; }
.kd-kpi__cmp { font-size: 12px; color: #7a8488; margin-top: 6px; }
.kd-kpi__cmp .up { color: #27ae60; font-weight: 700; } .kd-kpi__cmp .down { color: #c0392b; font-weight: 700; }

.kd-pv { width: 100%; height: 100%; overflow: auto; }
.kd-pivot { border-collapse: separate; border-spacing: 0; font-size: 12px; white-space: nowrap; }
.kd-pivot th, .kd-pivot td { border-right: 1px solid #eceff0; border-bottom: 1px solid #eceff0; padding: 5px 10px; text-align: right; }
.kd-pivot thead th { position: sticky; top: 0; z-index: 3; background: #eef3f5; color: #34495e; font-weight: 600; text-align: center; }
.kd-pivot thead tr:nth-child(2) th { top: 27px; }
.kd-pivot .rowhead { position: sticky; left: 0; z-index: 2; background: #fff; text-align: left; min-width: 190px; }
.kd-pivot thead .rowhead { z-index: 4; background: #eef3f5; text-align: left; font-weight: 500; color: #5a6468; font-size: 11.5px; }
.kd-pivot tr.lvl0 > .rowhead { font-weight: 700; }
.kd-pivot tr.lvl0 { background: #fafcfd; }
.kd-pivot tr.lvl1 > .rowhead { padding-left: 34px; }
.kd-pivot tr.grand { background: #eef3f5; font-weight: 700; }
.kd-pivot tr.grand .rowhead { background: #eef3f5; }
.kd-pivot .tg { display: inline-block; width: 14px; cursor: pointer; color: #7a8488; user-select: none; }
.kd-pivot .sep { border-left: 2px solid #d6dee1; }
.kd-pivot td.drill { cursor: pointer; }
.kd-pivot td.drill:hover { background: #eaf4fb; }

.kd-chart { width: 100%; height: 100%; display: block; }
.kd-chart text { font-family: inherit; font-size: 11px; fill: #5a6468; }
.kd-legend { position: absolute; right: 10px; top: 8px; font-size: 11px; color: #5a6468; display: grid; gap: 3px; }
.kd-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* 右の設定欄 */
.kd-panel { width: 300px; flex: none; background: #fff; border: 1px solid #e3e7e8; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.05); position: sticky; top: 12px; }
.kd-panel__head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: #34495e; color: #fff; border-radius: 8px 8px 0 0; font-weight: 700; }
.kd-panel__head button { border: 0; background: none; color: #fff; font-size: 16px; cursor: pointer; }
.kd-panel__body { padding: 10px 12px 14px; }
.kd-add { width: 100%; border: 1px dashed #3498db; background: #eaf4fb; color: #2c7bb6; border-radius: 6px; height: 34px; cursor: pointer; font: inherit; font-weight: 600; }
.kd-addmenu { margin-top: 6px; border: 1px solid #d6dee1; border-radius: 6px; overflow: hidden; }
.kd-addmenu button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #f0f3f4; background: #fff; padding: 8px 12px; font: inherit; font-size: 12px; cursor: pointer; color: #2c3e50; }
.kd-addmenu button:hover { background: #eaf4fb; }
.kd-editing { font-size: 11px; color: #7a8488; margin: 10px 0 6px; padding-bottom: 8px; border-bottom: 1px solid #eceff0; }
.kd-hint { font-size: 12px; color: #7a8488; line-height: 1.7; margin-top: 10px; }
.kd-form { display: flex; flex-direction: column; gap: 4px; }
.kd-form > label { font-size: 11px; font-weight: 700; color: #34495e; margin-top: 6px; }
.kd-i { height: 30px; border: 1px solid #d0d5d8; border-radius: 4px; padding: 0 8px; font: inherit; font-size: 12px; background: #fff; width: 100%; }
.kd-checks { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }
.kd-checks label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.kd-reset { margin-top: 14px; padding-top: 12px; border-top: 1px solid #eceff0; }
.kd-reset button { height: 28px; border: 1px solid #d0d5d8; background: #fff; border-radius: 4px; padding: 0 12px; font: inherit; font-size: 12px; cursor: pointer; color: #5a6468; }
.kd-reset p { font-size: 11px; color: #9aa3a7; margin: 6px 0 0; line-height: 1.6; }

/* 該当レコードの一覧 */
.kd-back { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1100; display: grid; place-items: center; }
.kd-modal { width: min(94vw, 1000px); height: min(80vh, 640px); background: #fff; border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.3); font-size: 12px; }
.kd-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #34495e; color: #fff; font-weight: 700; font-size: 14px; }
.kd-modal__head button { border: 0; background: none; color: #fff; font-size: 18px; cursor: pointer; }
.kd-modal__bar { display: flex; gap: 10px; align-items: center; padding: 8px 16px; border-bottom: 1px solid #eceff0; background: #fafcfd; }
.kd-modal__bar input { flex: 1; max-width: 360px; height: 30px; border: 1px solid #d0d5d8; border-radius: 4px; padding: 0 10px; font: inherit; font-size: 13px; }
.kd-modal__body { flex: 1; overflow: auto; }
.kd-dt { border-collapse: collapse; width: 100%; }
.kd-dt th, .kd-dt td { border-bottom: 1px solid #eceff0; padding: 6px 10px; text-align: left; white-space: nowrap; }
.kd-dt thead th { position: sticky; top: 0; background: #eef3f5; color: #34495e; cursor: pointer; user-select: none; }
.kd-dt thead th:hover { text-decoration: underline; }
.kd-dt .num { text-align: right; }
.kd-dt tbody tr:hover { background: #f5f9fb; }

.kd-confirm { width: 360px; height: auto; }
.kd-confirm .kd-modal__body { padding: 18px 16px; font-size: 13px; }
.kd-confirm .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid #eceff0; }

.kd-note { font-size: 12px; color: #7a8488; margin-top: 10px; }

@media (max-width: 900px) {
  .kd-main { flex-direction: column; }
  .kd-panel { width: 100%; position: static; }
  .kd-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kd-wide { padding: 0 16px; }
}

/* 全画面のときは外枠ごと前に出す（ページの後ろの節が上に重なっていた） */
.kd-wide.is-full-host { z-index: 1000; }
.kd-grid.is-edit .kd-card__head { user-select: none; }
