/* ============================================================
   bright-ui-shell / base.css — 社内システム共通部品（ボタン・カード・フォーム・表・モーダル・トースト）
   正本はチームハブ tools/ui-shell/。中身は bright-core-system の public/css/base.css と同じ（2026-09-14 に写した）。
   直すときは正本を直してから各システムに丸ごと写す。持ち出した先ではこの注記を残す
   ============================================================ */
@import url('/css/tokens.css'); /* 色・文字・余白のトークン（持ち出せる1ファイル）。先頭で読み込む */
/* BRIGHT 社内統合システム 共通部品（ボタン・カード・フォーム・テーブル・モーダル）
   レイアウト（サイドバー・ページ見出し）は shell.css。両方を読み込む */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── ボタン ── */
/* アイコンと文字を並べても中心がずれないよう、ボタンは常に inline-flex で天地中央にそろえる
   （UI標準 §12-4。2026-09-12 ケイさん指摘：「予約を追加」の＋がセンターからずれていた）。
   文字だけのボタンの見え方は今までと同じ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 7px;
  font-size: var(--fs-md);
  line-height: var(--lh-ui);
  cursor: pointer;
  border: none;
  font-family: var(--font);
  font-weight: 600;
  transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: var(--ink); font-weight: 700; }
.btn-primary:hover { background: var(--accent-dk); }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--ink-2); color: var(--ink); }
.btn-danger-ghost { background: none; border: 1px solid var(--border); color: var(--ink-2); }
.btn-danger-ghost:hover { border-color: var(--danger); color: var(--danger); }
.btn-dark { background: var(--ink-2); color: var(--on-dark); }
.btn-dark:hover { background: var(--dark); }
.btn-sm { padding: 5px 12px; font-size: var(--fs-sm); }
/* アイコンは行の高さに引きずられない（ベースラインの下に空きができて中心がずれる）。
   包みの `span[data-icon]` の中でも SVG がベースラインにそろってしまうため、包みごと中央にそろえる
   （2026-09-12 ケイさん指摘：包みを中央に置いても、中の SVG が 2.25px 浮いていた）。UI標準 §12-4 */
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
[data-icon] > svg { display: block; }
.btn > [data-icon], .btn > svg { flex: none; }

/* 押したあとの見せ方（UI標準 §12-4）。処理中は地を薄く・押せない・幅は変えない。動きは点3つだけ。
   付け外しは shell.js の runButton() が行う。画面側でこのクラスを直接付けない */
.btn-busy { opacity: .55; cursor: wait; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-dots { display: inline-flex; gap: 3px; flex-shrink: 0; }
.btn-dots i { width: 4px; height: 4px; border-radius: 999px; background: currentColor; opacity: .3; animation: btn-dot 900ms infinite; }
.btn-dots i:nth-child(2) { animation-delay: 300ms; }
.btn-dots i:nth-child(3) { animation-delay: 600ms; }
@keyframes btn-dot { 0%, 100% { opacity: .3; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .btn-dots i { animation: none; opacity: .6; } }
.btn-slow { display: block; margin-top: 6px; color: var(--ink-3); font-weight: 400; font-size: var(--fs-sm); line-height: var(--lh-text); }
/* 失敗の理由。消えるトーストにせず、ボタンの近くに残す */
.btn-err { display: block; margin-top: 8px; color: var(--danger); font-size: var(--fs-sm); line-height: var(--lh-text); }

/* ── カード ── */
.section-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.section-head {
  padding: 18px 26px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-m);
}
.section-icon { font-size: var(--fs-lg); line-height: 1; }
.section-title { font-size: var(--fs-lg); font-weight: 700; flex: none; white-space: nowrap; }          /* 見出しは折り返さない */
.section-desc { font-size: var(--fs-sm); color: var(--ink-3); margin-left: auto; padding-left: var(--sp-l); flex: 0 1 auto; min-width: 0; line-height: var(--lh-ui); } /* 説明文の側が縮んで折り返す */
.section-body { padding: var(--sp-l) 26px; }
.section-body > * + *:not(.form-row):not(.form-2col):not(.grid2) { margin-top: var(--sp-l); }  /* セットとセットの間＝開ける（大）。フォームの行は同じセットの項目なので対象外 */
.section-body > :empty { display: none; }                        /* JSで後から埋める空の器は余白を作らない */
.section-body > .hint, .section-body > .form-actions { margin-top: var(--sp-l); }
.section-card + .section-card { margin-top: var(--sp-l); }

/* ── フォーム ── */
.form-row { margin-bottom: 16px; }                              /* 項目どうし＝開ける（中）より少し広め */
.form-row label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: var(--sp-s);                                     /* ラベル→入力＝開ける（小） */
  line-height: var(--lh-ui);
}
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: var(--fs-md);
  line-height: var(--lh-ui);
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  border-color: var(--accent);
}
.form-row textarea { resize: vertical; min-height: 64px; line-height: var(--lh-text); }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── テーブル ── */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface-2); }
th {
  padding: 12px 16px;
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--ls-label);
  line-height: var(--lh-ui);
  color: var(--ink-3);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 13px 16px;
  font-size: var(--fs-md);
  line-height: var(--lh-ui);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

/* ── モーダル ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(40, 36, 28, 0.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
}
.modal-header {
  padding: 22px 26px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: var(--fs-lg); font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: var(--fs-xl);
  color: var(--ink-3);
  cursor: pointer;
}
.modal-body { padding: var(--sp-l) 26px 26px; }

/* ── 位置付きポップオーバー（工程管理表の期間バー編集・共有リンク等） ── */
.bar-popover {
  position: fixed;
  z-index: 300;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  padding: 14px 16px;
}
.bar-popover.menu { padding: 0; width: auto; }
.bp-title { font-size: var(--fs-sm); font-weight: 700; margin-bottom: var(--sp-m); }
.bp-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.bp-field label { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); }
.bp-field input {
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px;
  font-size: var(--fs-md); font-family: var(--font); background: var(--surface); outline: none;
}
.bp-field input:focus { border-color: var(--accent); }
.bp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bp-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }

/* ── 印刷プレビュー ── */
.pp-overlay {
  position: fixed; inset: 0; background: rgba(40, 36, 28, 0.5); z-index: 400;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.pp-modal {
  background: var(--surface); border-radius: 16px; width: min(1200px, 100%); height: min(92vh, 1000px);
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 64px rgba(0,0,0,0.3);
}
.pp-head { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.pp-title { font-size: var(--fs-lg); font-weight: 700; }
.pp-tabs { display: flex; gap: 4px; padding: 10px 20px 0; border-bottom: 1px solid var(--border); background: var(--surface); overflow-x: auto; flex-wrap: wrap; }
.pp-tab { padding: 8px 14px; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; border-radius: 7px 7px 0 0; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); border-bottom: none; white-space: nowrap; margin-bottom: -1px; }
.pp-tab.active { background: var(--bg); color: var(--ink); font-weight: 700; border-bottom: 1px solid var(--bg); }
.pp-body { flex: 1; overflow: hidden; background: var(--bg); padding: 16px; min-height: 0; }
.pp-sheets { margin: 0 auto; width: fit-content; }
.pp-sheet { display: none; background: var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,0.12); margin: 0 auto; overflow: hidden; }
.pp-sheet.on { display: block; }
.pp-foot { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pp-hint { font-size: var(--fs-sm); color: var(--ink-3); }

/* ── トースト ── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--dark);
  color: var(--on-dark);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: transform 0.3s;
  z-index: 999;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── バッジ ── */
.badge {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: var(--lh-tight);
  padding: 3px 9px;
  border-radius: 999px;
}

/* ── 空状態 ── */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); font-size: var(--fs-sm); line-height: var(--lh-text); }
