/* ════════════════════════════════════════════════════════════════════════════
   orgPyramid.css — 組織図（パルファン形式） (public/orgPyramid.js). Drawn as the PRINTED chart is: a white sheet
   with thin black boxes, names in the legend's colours. The sheet stays white in dark mode on purpose — the
   name colours (blue / black / purple / green) carry meaning and are only legible on paper white.
   ════════════════════════════════════════════════════════════════════════════ */

.pyr-toolbar { display: flex; flex-wrap: wrap; gap: var(--ui-sp-2); align-items: center; margin-bottom: var(--ui-sp-3); }
.pyr-scroll { overflow: auto; max-width: 100%; border: 1px solid var(--ui-border); border-radius: var(--ui-r-lg); background: #fff; box-shadow: var(--ui-shadow-card); }

.pyr-sheet {
  --pyr-line: #222;
  display: inline-block; min-width: 100%; box-sizing: border-box;
  padding: 18px 20px 24px; background: #fff; color: #111;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  font-size: 11px; line-height: 1.45;
}
.pyr-c-blue { color: #0b2fd6; }
.pyr-c-black { color: #111; }
.pyr-c-purple { color: #7030a0; }
.pyr-c-green { color: #2f8f2f; }

/* title block */
.pyr-head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 10px; }
.pyr-title { padding: 5px 22px; border: 3px double var(--pyr-line); font-size: 15px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.pyr-date { padding-left: 40px; font-size: 13px; font-weight: 700; }

/* top: legend | 株主総会 … 社長 | board */
.pyr-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 16px; }
.pyr-legend { align-self: center; font-size: 10px; line-height: 1.7; }
.pyr-legend-q { color: #555; }
.pyr-stack { display: flex; flex-direction: column; align-items: center; }
.pyr-box { border: 1px solid var(--pyr-line); background: #fff; text-align: center; }
.pyr-small { min-width: 130px; padding: 7px 14px; font-weight: 600; }
.pyr-v { width: 0; height: 14px; border-left: 1px solid var(--pyr-line); }
.pyr-v-long { height: 22px; }
/* 社長 in the middle column, 社長室 in the right one, an empty left column of the same width keeps 社長 centred
   under 株主総会 and 取締役会 however long the 社長室 list is */
.pyr-pres-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; }
.pyr-pres-row::before { content: ''; }
.pyr-pres { min-width: 160px; }
.pyr-box-t { padding: 6px 12px; border-bottom: 1px solid var(--pyr-line); font-weight: 600; }
.pyr-box-b { padding: 6px 12px; font-weight: 600; }
.pyr-office-wrap { display: flex; align-items: flex-start; }
.pyr-hline { width: 14px; margin-top: 24px; border-top: 1px solid var(--pyr-line); }
.pyr-office { min-width: 120px; white-space: nowrap; }
.pyr-office .pyr-box-b { font-size: 10px; line-height: 1.6; }
.pyr-board { justify-self: end; border-collapse: collapse; font-size: 10.5px; }
.pyr-board th, .pyr-board td { border: 1px solid var(--pyr-line); padding: 5px 12px; white-space: nowrap; text-align: center; }
.pyr-board th { font-weight: 600; }

/* the grid: one table so every row lines up across all 本部, as on the printed sheet */
.pyr-grid-wrap { display: flex; justify-content: center; }
.pyr-grid { border-collapse: separate; border-spacing: 0; table-layout: auto; }
.pyr-grid td { padding: 0; vertical-align: middle; text-align: center; }
.pyr-grid td.pyr-gap { width: 12px; min-width: 12px; border: 0; }
.pyr-hq, .pyr-hqh, .pyr-bu, .pyr-hd, .pyr-ka, .pyr-mem { border: 1px solid var(--pyr-line); border-top-width: 0; }
.pyr-bu, .pyr-hd, .pyr-ka, .pyr-mem, .pyr-hq, .pyr-hqh { border-left-width: 0; }
/* the first cell of a column, and the first after a gap, carries the left edge */
.pyr-grid tr > td:first-child, .pyr-grid td.pyr-gap + td { border-left-width: 1px; }
.pyr-hq { border-top-width: 1px; padding: 6px 6px; font-weight: 600; }
.pyr-hqh { padding: 4px 6px 6px; font-weight: 600; }
.pyr-sp { height: 12px; border: 0; }
.pyr-bu { border-top-width: 1px; padding: 6px 4px; font-weight: 600; }
.pyr-ka { padding: 5px 4px; font-weight: 600; }
.pyr-hd { padding: 4px 4px; min-width: 64px; }
.pyr-mem { vertical-align: top !important; padding: 8px 4px 10px; height: 110px; }
.pyr-ka, .pyr-hd, .pyr-mem { min-width: 64px; }
.pyr-dash { color: #444; }
.pyr-list { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pyr-li { white-space: nowrap; }
.pyr-split { display: block; font-size: 9.5px; color: #555; border-bottom: 1px dashed #888; margin: 0 -4px 2px; }
.pyr-n { font-weight: 600; white-space: nowrap; }
.pyr-tt { margin-left: .3em; }
.pyr-mk { font-weight: 500; }
.pyr-q { margin-left: 1px; font-size: 8px; color: #b45309; font-weight: 700; }

/* the bus over the columns */
.pyr-r-bus td { height: 14px; position: relative; border: 0; }
.pyr-bus::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px solid var(--pyr-line); }
.pyr-bus.is-first::before { content: ''; position: absolute; left: 50%; right: 0; top: 0; border-top: 1px solid var(--pyr-line); }
.pyr-bus.is-mid::before { content: ''; position: absolute; left: 0; right: 0; top: 0; border-top: 1px solid var(--pyr-line); }
.pyr-bus.is-last::before { content: ''; position: absolute; left: 0; right: 50%; top: 0; border-top: 1px solid var(--pyr-line); }
.pyr-r-bus td.pyr-bus-mid::before { content: ''; position: absolute; left: 0; right: 0; top: 0; border-top: 1px solid var(--pyr-line); }

/* bottom: 出向社員 and anyone the chart did not place */
.pyr-bottom { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; margin-top: 18px; }
.pyr-sec { border-collapse: collapse; font-size: 10.5px; }
.pyr-sec th, .pyr-sec td { border: 1px solid var(--pyr-line); padding: 3px 10px; text-align: left; white-space: nowrap; }
.pyr-sec th { text-align: center; font-weight: 600; }
.pyr-sec-to { color: #7030a0; }
.pyr-others { max-width: 520px; padding: 8px 12px; border: 1px dashed #999; }
.pyr-others-t { font-weight: 700; }
.pyr-others-n { margin: 2px 0 6px; color: #555; font-size: 10px; }
.pyr-others-l { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.pyr-where { color: #666; font-size: 10px; }

/* editor */
.pyr-host { min-width: 0; max-width: 100%; }
.pyr-editor .mj-table-wrap { max-width: 100%; overflow-x: auto; }
.pyr-editor { box-sizing: border-box; max-width: 100%; min-width: 0; margin-bottom: var(--ui-sp-3); padding: var(--ui-sp-4); display: flex; flex-direction: column; gap: var(--ui-sp-3); }
.pyr-ed-note { margin: 0; padding: 8px 12px; border-radius: var(--ui-r-sm); background: var(--ui-sunken); color: var(--ui-text-2); font-size: var(--ui-fs-sm); }
.pyr-form { display: flex; flex-wrap: wrap; gap: var(--ui-sp-2) var(--ui-sp-3); align-items: flex-end; }
.pyr-f { min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 4px; font-size: var(--ui-fs-xs); color: var(--ui-text-3); }
.pyr-f .mj-input { min-width: 180px; max-width: 100%; }
.pyr-chk { display: inline-flex; gap: 6px; align-items: center; height: 36px; font-size: var(--ui-fs-sm); color: var(--ui-text); }
.pyr-msg { margin: 0; font-size: var(--ui-fs-sm); color: var(--ui-text-2); }
.pyr-msg.is-bad { color: var(--ui-danger, #b42318); }
.pyr-ed-table td { font-size: var(--ui-fs-sm); }
.pyr-stale td { color: var(--ui-text-4); }

@media (max-width: 640px) {
  .pyr-top { grid-template-columns: 1fr; }
  .pyr-board { justify-self: start; }
  .pyr-pres-row { display: flex; flex-direction: column; align-items: center; }
  .pyr-office-wrap { margin-top: 8px; }
  .pyr-hline { display: none; }
  .pyr-f .mj-input { min-width: 0; width: 100%; }
  .pyr-f { flex: 1 1 100%; }
}

/* ── on screen: the printed structure in the 組織マップ's cards, boxes and dots (orgMap.css) ───────────────
   One grid for all 本部 with nested subgrids, so 部 / 部長 / 課 / 課長 / リーダー / members line up across columns as
   on the paper: rows 1 本部 + 本部長, 2 部, 3 部長, 4 課, 5 課長, 6 リーダー, 7 members. */
.pyr-om { padding-top: 2px; }
.pyr-om .pyr-toolbar { margin: 0 0 var(--ui-sp-3); }
/* zoom and moving around (2026-10-27): the toolbar stays in view while the chart scrolls under it */
.pyr-om { cursor: grab; }
.pyr-om.is-panning { cursor: grabbing; user-select: none; }
.pyr-om .pyr-toolbar { position: sticky; top: 0; left: 0; z-index: 5; width: max-content; max-width: 100%; padding: 4px 0 6px; background: var(--ui-bg, #fff); cursor: default; }
.pyr-zoom { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--ui-border); border-radius: var(--ui-r-pill, 999px); background: var(--ui-surface); }
.pyr-zoom .mj-btn { padding: 4px 10px; min-height: 28px; }
.pyr-zbtn { font-size: 16px; line-height: 1; width: 32px; padding: 4px 0 !important; }
.pyr-zlabel { min-width: 56px; font-variant-numeric: tabular-nums; }
.pyr-zhint { font-size: var(--ui-fs-xs, 11px); color: var(--ui-text-3); }
@media (max-width: 760px) { .pyr-zhint { display: none; } }
.pyr-om-area { display: inline-block; min-width: 100%; box-sizing: border-box; font-size: 12.5px; line-height: 1.45; }
.pyr-om-top { margin-bottom: 6px; }
.pyr-om-top .pyr-legend { align-self: start; padding-top: 4px; }
.pyr-om-small { margin: 0; padding: 6px 16px; border-style: solid; border-color: var(--ui-border-strong); background: var(--ui-surface); text-align: center; }
.pyr-om-small .om-box-title { margin: 0; font-size: var(--ui-fs-sm); font-weight: 700; color: var(--ui-text); }
.pyr-om-top .pyr-v, .pyr-om-top .pyr-hline { border-color: var(--ui-border-strong); }
.pyr-om-top .om-card { margin: 0; min-width: 150px; }
.pyr-om-board { justify-self: end; display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; }
.pyr-om-brow { display: flex; align-items: center; gap: 10px; }
.pyr-om-btitle { min-width: 96px; font-weight: 600; color: var(--ui-text-2); }

.pyr-om-gridwrap { display: flex; justify-content: safe center; width: max-content; min-width: 100%; padding-top: 14px; border-top: 1.5px solid var(--ui-border-strong); margin-top: 4px; }
.pyr-om-grid { flex: none; display: grid; grid-template-rows: repeat(7, auto); column-gap: 14px; align-items: stretch; }
.pyr-om-col { position: relative; margin: 0; grid-row: 1 / span 7; display: grid; grid-template-columns: subgrid; grid-template-rows: subgrid; column-gap: 10px; row-gap: 0; padding: 10px 12px 10px; }
.pyr-om-col::before { content: ''; position: absolute; left: 50%; top: -15px; height: 14px; border-left: 1.5px solid var(--ui-border-strong); }
.pyr-om-head { grid-column: 1 / -1; grid-row: 1; flex-direction: column; align-items: center; gap: 4px; margin: 0 0 8px; text-align: center; }
.pyr-om-hq { font-size: var(--ui-fs-sm); }
.pyr-om-bu { grid-row: 2 / span 6; display: grid; grid-template-columns: subgrid; grid-template-rows: subgrid; column-gap: 10px; row-gap: 0; margin: 0; padding: 8px; }
.pyr-om-bu.is-none { border-color: transparent; }
.pyr-om-t { text-align: center; font-weight: 700; font-size: 12.5px; color: var(--ui-text); margin: 0 0 6px; }
.pyr-om-bu > .pyr-om-t { grid-column: 1 / -1; grid-row: 1; }
.pyr-om-bucho { grid-row: 2; padding: 4px 0 8px; border-bottom: 1px dotted #d4dae1; margin-bottom: 8px; }
.pyr-om-ka { grid-row: 3 / span 4; display: grid; grid-template-rows: subgrid; row-gap: 0; margin: 0; padding: 8px 10px 10px; background: var(--ui-surface); }
.pyr-om-ka > .pyr-om-t { grid-row: 1; }
.pyr-om-kacho { grid-row: 2; }
.pyr-om-leader { grid-row: 3; border-top: 1px dotted #e3e7ec; padding: 6px 0; }
.pyr-om-mem { grid-row: 4; border-top: 1px dotted #e3e7ec; padding-top: 6px; min-height: 40px; }
.pyr-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.pyr-om-head .pyr-cell, .pyr-om-bucho .pyr-cell, .pyr-om-t + .pyr-cell { align-items: center; }
.pyr-p { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pyr-p .om-dot { width: 24px; height: 24px; min-width: 24px; font-size: 10.5px; }
.pyr-p .pyr-split { display: inline; margin: 0 2px 0 0; border: 0; font-size: 10px; color: var(--ui-text-3); }
.pyr-cap { border: 0; background: none; padding: 0; font: inherit; text-align: left; cursor: pointer; white-space: nowrap; }
span.pyr-cap { cursor: default; }
.pyr-cap:hover .pyr-nm { text-decoration: underline; }
.pyr-cap .pyr-n { font-weight: 600; }
.pyr-om .pyr-c-black { color: var(--ui-text); }
.pyr-om .pyr-dash { color: var(--ui-text-4); }
.pyr-om-sec, .pyr-om-others { margin: 0; }
.pyr-om-srow, .pyr-om-orow { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.pyr-om .pyr-sec-to { color: #7030a0; font-size: 11px; }
.pyr-probe { position: absolute; left: -100000px; top: 0; visibility: hidden; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pyr-om .pyr-c-blue { color: #79a6ff; }
  :root:not([data-theme="light"]) .pyr-om .pyr-c-purple { color: #c39af0; }
  :root:not([data-theme="light"]) .pyr-om .pyr-c-green { color: #6fcf6f; }
}
:root[data-theme="dark"] .pyr-om .pyr-c-blue { color: #79a6ff; }
:root[data-theme="dark"] .pyr-om .pyr-c-purple { color: #c39af0; }
:root[data-theme="dark"] .pyr-om .pyr-c-green { color: #6fcf6f; }

/* ── print: only the sheet, one A3 landscape page ───────────────────────── */
#pyr-print-root { display: none; }
@page pyr { size: A3 landscape; margin: 8mm; }
@media print {
  body.pyr-printing > *:not(#pyr-print-root) { display: none !important; }
  body.pyr-printing { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body.pyr-printing #pyr-print-root { display: block !important; page: pyr; }
  #pyr-print-root .pyr-sheet { padding: 0; min-width: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
