/* ClassWeaver — Workspace スタイル
 *
 * UI 三原則 (CLAUDE.md / docs/03-functional-design.md § 0):
 *   1. 情報密度の最適化
 *   2. 1 画面 Workspace 型
 *   3. チェックリスト型 + 非線形編集
 *
 * masarusuto.com 教訓: モダン CSS の罠を避け、table 直球で行く
 */

/* ============================================================
 *  ベース
 * ============================================================ */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Noto Sans JP", "Meiryo", sans-serif;
  font-size: 14px;
  color: #222;
  background: #f5f5f5;
}

a {
  color: #1a3a52;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============================================================
 *  Workspace レイアウト
 * ============================================================ */
.workspace {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.workspace-header {
  background: #1a3a52;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.workspace-header .brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.workspace-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.phase-badge {
  background: #e8a838;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* PR #34: 自動保存ステータス (履歴保存ボタンとは別の subtle 表示) */
.auto-save-status {
  color: #a8c6dc;
  font-size: 12px;
  padding: 0 8px;
  font-style: italic;
}

/* PR #34: テンプレバッジ */
.template-badge {
  background: #fef3c7;
  color: #78350f;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #fbbf24;
  margin-right: 8px;
  font-weight: 600;
}

/* Issue #42: 現在 PJ 表示を Word タイトルバー風に強化 */
.current-project-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  margin: 0 16px;
  flex: 1;
  min-width: 0;
  max-width: 600px;
}

/* コンパクト版 (元「プロジェクトを開く」位置、~16 全角文字想定 = ~250px) */
.current-project-display.current-project-display--compact {
  flex: none;
  max-width: 280px;
  margin: 0 12px 0 8px;
}

.current-project-display .cp-icon {
  font-size: 16px;
}

.current-project-display .cp-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-project-display .cp-meta {
  font-size: 11px;
  color: #a8c6dc;
  white-space: nowrap;
}

/* 中央スペーサー (今後のボタン増設に備える、ヘッダー右端要素を右に押し出す) */
.header-spacer {
  flex: 1;
  min-width: 0;
}

.cp-settings-link {
  color: #a8c6dc;
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 14px;
  transition: background 0.15s;
}

.cp-settings-link:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* PR #54: 自動生成パネル quota status banner */
.quota-status-banner {
  background: #f0f7fc;
  border: 1px solid #b8d4ea;
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quota-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.quota-label {
  color: #1a3a52;
  font-weight: 600;
}

.quota-value {
  color: #333;
}

.quota-remaining {
  color: #2c7a4a;
  font-weight: 600;
  font-size: 12px;
  margin-left: 4px;
}

.quota-warning {
  color: #b9320c;
  font-weight: 700;
  font-size: 11px;
  margin-left: 6px;
}

.btn-link {
  background: none;
  border: 1px solid #1a3a52;
  color: #1a3a52;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  align-self: flex-end;
  margin-top: 4px;
}

.btn-link:hover {
  background: #1a3a52;
  color: #fff;
}

/* PR #54: チケット購入 modal */
.ticket-purchase-dialog {
  border: none;
  border-radius: 8px;
  padding: 0;
  width: 500px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.ticket-purchase-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.ticket-purchase-dialog-header {
  background: #1a3a52;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ticket-purchase-dialog-header h2 {
  margin: 0;
  font-size: 16px;
}

.ticket-purchase-dialog-body {
  padding: 16px;
}

.ticket-pack-list {
  list-style: none;
  margin: 12px 0 0 0;
  padding: 0;
}

.ticket-pack-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 8px;
}

.ticket-pack-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ticket-pack-info strong {
  color: #1a3a52;
  font-size: 14px;
}

.ticket-pack-price {
  color: #e7a72d;
  font-weight: 700;
  font-size: 16px;
}

.ticket-pack-per-unit {
  color: #666;
  font-size: 11px;
}

/* PR #54+ Admin dashboard (Gemini + Claude unified) */
.admin-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #eef0f2;
}

.admin-header {
  background: #2d3748;       /* slightly lighter gray than user header */
  color: #fff;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #e7a72d;
}

.admin-brand {
  color: #fff;
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
}

.admin-badge {
  background: #e7a72d;
  color: #1a3a52;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 3px;
  margin-left: 8px;
  letter-spacing: 1px;
}

.admin-header-right {
  display: flex;
  gap: 16px;
  align-items: center;
}

.admin-user {
  font-size: 13px;
  color: #cbd5e0;
}

.admin-back-link {
  color: #fff;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 13px;
}

.admin-back-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.admin-body {
  display: flex;
  flex: 1;
}

.admin-sidebar {
  width: 240px;
  background: #4a5568;
  color: #fff;
  padding: 16px 0;
}

.admin-sidebar nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-sidebar .admin-nav-link {
  display: block;
  padding: 10px 20px;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}

.admin-sidebar .admin-nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.admin-sidebar .admin-nav-link.active {
  background: rgba(231, 167, 45, 0.15);
  border-left-color: #e7a72d;
  font-weight: 700;
}

.admin-main {
  flex: 1;
  padding: 24px 32px;
  background: #fff;
}

.admin-main h1 {
  margin-top: 0;
  color: #1a3a52;
}

.admin-help {
  background: #fffbeb;
  border-left: 3px solid #e7a72d;
  padding: 8px 12px;
  font-size: 13px;
  color: #555;
}

.admin-flash {
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 4px;
  font-size: 13px;
}

.admin-flash--success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.admin-flash--error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

/* KPI cards */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 16px 0 24px;
}

.admin-kpi-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 16px;
}

.admin-kpi-label {
  font-size: 12px;
  color: #666;
}

.admin-kpi-value {
  font-size: 32px;
  font-weight: 800;
  color: #1a3a52;
  margin: 4px 0;
}

.admin-kpi-sub {
  font-size: 11px;
  color: #888;
}

/* Search form */
.admin-search-form {
  margin-bottom: 16px;
}

.admin-search-input {
  width: 100%;
  max-width: 500px;
  padding: 8px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

/* Tables */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}

.admin-table th {
  background: #2d3748;
  color: #fff;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
}

.admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
}

.admin-table tr.is-inactive {
  background: #fef2f2;
  opacity: 0.7;
}

.admin-table tr:hover {
  background: #f9fafb;
}

/* Status / role chips */
.admin-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
}

.admin-status--active {
  background: #d1fae5;
  color: #065f46;
}

.admin-status--inactive {
  background: #fee2e2;
  color: #991b1b;
}

.admin-role {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
}

.admin-role--super_admin {
  background: #fef3c7;
  color: #78350f;
}

.admin-role--school_admin {
  background: #e0e7ff;
  color: #3730a3;
}

.admin-action-link {
  color: #1a3a52;
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid #cbd5e0;
  border-radius: 3px;
}

.admin-action-link:hover {
  background: #1a3a52;
  color: #fff;
}

.admin-empty {
  padding: 24px;
  text-align: center;
  color: #888;
}

/* User detail */
.admin-user-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.admin-info-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px 16px;
}

.admin-info-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #1a3a52;
  border-bottom: 1px solid #cbd5e0;
  padding-bottom: 4px;
}

.admin-info-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 4px 12px;
  font-size: 12px;
}

.admin-info-card dt {
  font-weight: 600;
  color: #555;
}

.admin-info-card dd {
  margin: 0;
}

.admin-project-list {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
}

/* Action panel */
.admin-action-panel {
  background: #fffbeb;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  padding: 16px;
  margin-top: 24px;
}

.admin-action-panel h2 {
  margin-top: 0;
  color: #78350f;
}

.admin-action-section {
  margin-bottom: 16px;
}

.admin-action-section h4 {
  margin: 8px 0;
  font-size: 13px;
}

.admin-btn {
  background: #1a3a52;
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 8px;
  margin-bottom: 4px;
  font-family: inherit;
}

.admin-btn:hover {
  opacity: 0.9;
}

.admin-btn--warn {
  background: #d97706;
}

.admin-btn--danger {
  background: #c0392b;
}

.admin-btn--success {
  background: #2c7a4a;
}

.admin-todo {
  font-size: 13px;
  color: #666;
}

.template-banner-strong {
  background: #fef3c7;
  color: #78350f;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 700;
  border: 1px solid #fbbf24;
  white-space: nowrap;
}

/* Issue #56: 「プロジェクトを開く」 ボタン (左側、強調) */
.header-link.header-link-primary {
  background: #e7a72d;
  color: #1a3a52;
  border-color: #e7a72d;
  font-weight: 700;
  margin-right: 8px;
}

.header-link.header-link-primary:hover {
  background: #d09524;
  border-color: #d09524;
}

/* 「プロジェクトを開く」 modal */
.open-project-dialog {
  border: none;
  border-radius: 8px;
  padding: 0;
  width: 600px;
  max-width: 90vw;
  max-height: 80vh;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.open-project-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.open-project-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.open-project-dialog-header {
  background: #1a3a52;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.open-project-dialog-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.open-project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.open-project-item {
  border-bottom: 1px solid #eee;
}

.open-project-item button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  font-family: inherit;
}

.open-project-item button:hover {
  background: #f9fafb;
}

.open-project-item.is-current button {
  background: #fffbeb;
  font-weight: 600;
}

.op-icon {
  font-size: 18px;
}

.op-name {
  flex: 1;
  font-weight: 600;
}

.op-meta {
  font-size: 12px;
  color: #666;
}

.op-current-badge {
  background: #e7a72d;
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
}

.open-project-dialog-footer {
  background: #f9fafb;
  padding: 12px 16px;
  border-top: 1px solid #eee;
  text-align: right;
}

.open-project-dialog-footer .header-link {
  background: transparent;
  color: #1a3a52;
  border: 1px solid #cbd5e0;
  padding: 6px 14px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.open-project-dialog-footer .header-link:hover {
  background: #f0f0f0;
}

.file-info .filename {
  color: #ccc;
  font-size: 13px;
}

.workspace-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ============================================================
 *  サイドバー (UI 原則 ②: 常時表示)
 * ============================================================ */
.sidebar {
  width: 240px;
  background: #fff;
  border-right: 1px solid #ddd;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar section {
  padding: 16px;
  border-bottom: 1px solid #eee;
}

.sidebar h2 {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar li {
  padding: 4px 0;
  font-size: 13px;
}

/* ----------------- 進捗チェックリスト (UI 原則 ③) ----------------- */
.progress-item {
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-item--done {
  color: #3a7d44;
}

.progress-item--in_progress {
  color: #c8950e;
  font-weight: 500;
}

.progress-item--pending {
  color: #999;
}

.progress-detail {
  font-size: 11px;
  color: #888;
  margin-left: auto;
}

/* ----------------- ナビゲーションリンク ----------------- */
.nav-link {
  display: block;
  padding: 6px 8px;
  border-radius: 4px;
  color: #333;
  transition: background 0.15s;
}

.nav-link:hover {
  background: #f0f0f0;
  text-decoration: none;
}

.nav-link--alert {
  color: #c0392b;
}

/* ============================================================
 *  メインペイン (UI 原則 ②: 時間割マトリクスを常時表示)
 * ============================================================ */
.main-pane {
  flex: 1;
  background: #fff;
  padding: 24px;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.class-selector {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.class-selector select {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
}

/* ============================================================
 *  時間割マトリクス (table 直球、案 A: 全幅使う)
 *  ワイドモニターでセルが大きく見える、ぱっと見の情報量が多い
 * ============================================================ */
.timetable-grid {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  margin-bottom: 16px;
}

.timetable-grid th,
.timetable-grid td {
  border: 1px solid #ccc;
  padding: 12px 8px;
  text-align: center;
  vertical-align: top;
  min-height: 60px;
}

.timetable-grid thead th {
  background: #f0f0f0;
  font-weight: 600;
  color: #444;
}

.timetable-grid tbody th {
  background: #f5f5f5;
  font-weight: 500;
  width: 60px;
}

.cell {
  cursor: pointer;
  transition: background 0.15s;
}

.cell:hover {
  background: #f8f8f8;
}

.cell--empty {
  color: #d0d0d0;
}

.cell-empty-marker {
  font-size: 16px;
  line-height: 1;
}

.cell--violation {
  background: #ffe5e5;
}

.cell--warning {
  background: #fff5d5;
}

/* ============================================================
 *  ステータスバー
 * ============================================================ */
.status-bar {
  display: flex;
  gap: 24px;
  padding: 8px 12px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  color: #666;
  margin-top: auto;
}

/* ============================================================
 *  ボタン
 * ============================================================ */
.btn-primary,
.btn-secondary {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: #e8a838;
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: #d49920;
}

.btn-primary:disabled {
  background: #999;
  cursor: not-allowed;
}

.btn-secondary {
  background: #1a3a52;
  color: #fff;
}

.btn-secondary:hover {
  background: #2a4a62;
}

/* ============================================================
 *  サイドパネル (右ペインオーバーレイ、htmx で内容差し込み)
 *  クリックで開閉、メイン時間割は背景で見え続ける (UI 原則 ②)
 * ============================================================ */
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 720px;        /* Phase 7 PR #32: 480 → 720, ラベル付フォーム余裕 */
  max-width: 90vw;     /* 1366px ノートでも常識的に収まる */
  background: #fff;
  border-left: 1px solid #ddd;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.08);
  overflow-y: auto;
  z-index: 100;
}

/* 中身が空の時はパネルごと非表示 */
.side-panel:empty {
  display: none;
}

.panel-header {
  position: sticky;
  top: 0;
  background: #1a3a52;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}

.panel-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.panel-close {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}

.panel-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* PR #35: 明示的「× 閉じる」 ボタンスタイル (mockup 採用) */
.panel-close--labeled {
  width: auto;
  height: auto;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  letter-spacing: 0.5px;
}

.panel-body {
  padding: 16px;
}

/* ============================================================
 *  ヒントバナー / Empty / Info note
 * ============================================================ */
.hint-banner {
  background: #fff8dd;
  border: 1px solid #f0d878;
  border-radius: 4px;
  padding: 8px 12px;
  margin-bottom: 16px;
  font-size: 12px;
  color: #614c10;
}

.hint-banner strong {
  color: #b9320c;
}

.hint-detail {
  margin-top: 4px;
  font-size: 11px;
  color: #8a7028;
}

.info-note {
  background: #eaf3f9;
  border-left: 3px solid #1a3a52;
  padding: 8px 12px;
  margin: 12px 0;
  font-size: 12px;
  color: #2c4757;
}

/* 警告バナー (Phase 7 PR #30) */
.warn-banner {
  background: #fff1f0;
  border: 1px solid #ffa39e;
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #5c1c1c;
}

.warn-banner strong {
  color: #b9320c;
}

/* Subject chip (Phase 7 PR #30) */
.subject-chip {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #f4f4f4;
  margin: 1px 2px;
  white-space: nowrap;
}

.muted {
  color: #999;
  font-style: italic;
  font-size: 12px;
}

.muted-label {
  color: #888;
  font-weight: normal;
  font-size: 11px;
}

.required {
  color: #c0392b;
}

.wrap-text {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 200px;
  font-size: 12px;
}

/* Vertical form rows (Phase 7 PR #30 — teacher form) */
.add-form--vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-form--vertical .form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.add-form--vertical label {
  font-size: 12px;
  font-weight: 600;
  color: #1a3a52;
}

.add-form--vertical input[type="text"],
.add-form--vertical textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #cbd5e0;
  border-radius: 3px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}

.add-form--vertical textarea {
  resize: vertical;
}

/* 担当科目 checkbox grid */
.subject-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #fafbfc;
  max-height: 140px;
  overflow-y: auto;
}

.subject-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: normal !important;
  cursor: pointer;
}

.subject-checkbox input[type="checkbox"] {
  margin: 0;
}

/* 案 A 縦型フォームのヘルプテキスト (Phase 7 PR #32) */
.add-form--vertical .form-title {
  margin: 0 0 6px 0;
  font-size: 13px;
  font-weight: 700;
  color: #1a3a52;
  border-bottom: 2px solid #1a3a52;
  padding-bottom: 3px;
}

.add-form--vertical .form-help {
  display: block;
  font-size: 11px;
  color: #777;
  margin-top: 1px;
}

.add-form--vertical .form-row .inline-pair {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* PR #35: nano banana mockup ベース — label-left 横並び + 3 列固定 grid */

.add-form--vertical.form-grid {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-form--vertical.form-grid .form-title {
  margin: 0 0 6px 0;
  font-size: 14px;
  font-weight: 700;
  color: #1a3a52;
  border-bottom: 2px solid #1a3a52;
  padding-bottom: 4px;
}

/* 単一フィールド行 (label 左 + input 右) */
.add-form--vertical.form-grid .form-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0 12px;
  align-items: center;
  margin: 0;
}

.add-form--vertical.form-grid .form-row > label {
  font-size: 12px;
  font-weight: 600;
  color: #1a3a52;
  margin: 0;
  white-space: nowrap;
}

/* textarea 行は label 上、入力は下フル幅で多行 */
.add-form--vertical.form-grid .form-row.form-row--multiline {
  grid-template-columns: 100px 1fr;
  align-items: start;
}

.add-form--vertical.form-grid .form-row.form-row--multiline textarea {
  min-height: 48px;
}

/* 短い項目 3 つを 1 行に均等配置 (短縮+色+週コマ等)
   各セルは: label + input が横並び */
.add-form--vertical.form-grid .form-row-inline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-items: center;
}

.add-form--vertical.form-grid .form-field {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
}

.add-form--vertical.form-grid .form-field > label {
  font-size: 12px;
  font-weight: 600;
  color: #1a3a52;
  white-space: nowrap;
  margin: 0;
}

.add-form--vertical.form-grid > button[type="submit"] {
  align-self: flex-end;
  padding: 6px 20px;
  margin-top: 4px;
}

/* 入力欄サイズ */
.add-form--vertical.form-grid input[type="text"],
.add-form--vertical.form-grid input[type="number"],
.add-form--vertical.form-grid select {
  padding: 5px 8px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}

.add-form--vertical.form-grid input[type="color"] {
  width: 60px;
  height: 30px;
  padding: 2px;
  cursor: pointer;
}

.add-form--vertical.form-grid textarea {
  padding: 5px 8px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  resize: vertical;
}

.add-form--vertical.form-grid .form-help {
  display: none;
}

/* 一覧表セクション (フォームの下) のラベル */
.list-section-title {
  margin: 8px 0 4px 0;
  font-size: 13px;
  font-weight: 700;
  color: #1a3a52;
  border-bottom: 1px solid #ddd;
  padding-bottom: 2px;
}

/* PR #35: 色名チップ (mockup) - 表のセル用 */
.color-name-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 4px;
  color: #fff;
  white-space: nowrap;
  border: none;
  text-shadow: 0 0 2px rgba(0,0,0,0.3);
}

/* 空セル明示 */
.empty-cell {
  color: #aaa;
  font-size: 11px;
}

/* PR #36: 稼働状態アイコン (時間枠 mockup) */
.active-icon {
  color: #2c7a4a;
  font-size: 16px;
  font-weight: 700;
}

.inactive-icon {
  color: #b9320c;
  font-size: 14px;
  font-weight: 700;
}

.inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: normal !important;
  cursor: pointer;
  color: #333 !important;
}

.inline-checkbox input[type="checkbox"] {
  margin: 0;
}

/* 担当科目 0件時の placeholder (Phase 7 PR #31) */
.subject-checkboxes--empty {
  background: #fff8dd;
  border-color: #f0d878;
  padding: 8px 12px;
  font-size: 12px;
  color: #614c10;
  max-height: none;
}

/* インライン編集行 (Phase 7 PR #31) */
tr.edit-row {
  background: #f0f7fc;
}

tr.edit-row td {
  vertical-align: top;
  padding: 6px 4px;
}

.inline-input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #4a90c2;
  border-radius: 3px;
  font-size: 12px;
  font-family: inherit;
  box-sizing: border-box;
}

textarea.inline-input {
  resize: vertical;
  min-height: 32px;
}

.subject-checkboxes--inline {
  max-height: 80px;
  font-size: 11px;
  padding: 4px;
}

.subject-checkboxes--inline .subject-chip {
  font-size: 10px;
  padding: 1px 4px;
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: #888;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

/* ============================================================
 *  マスター一覧テーブル (パネル内)
 * ============================================================ */
.master-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}

.master-table th,
.master-table td {
  border: 1px solid #ddd;
  padding: 6px 8px;
  text-align: left;
}

.master-table thead th {
  background: #f5f5f5;
  font-weight: 600;
  color: #555;
}

.master-table.compact th,
.master-table.compact td {
  padding: 4px 6px;
  font-size: 12px;
}

.master-table .empty-row {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 16px 8px;
}

.color-chip {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid #ccc;
  vertical-align: middle;
  margin-right: 4px;
}

/* ============================================================
 *  追加フォーム (パネル内、横並び)
 * ============================================================ */
.add-form {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px;
  background: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 4px;
  flex-wrap: wrap;
}

.add-form input,
.add-form select {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
}

.add-form input[type="text"],
.add-form input[type="email"] {
  flex: 1;
  min-width: 100px;
}

.add-form .btn-primary {
  padding: 4px 12px;
  font-size: 13px;
}

.add-form--multi {
  flex-wrap: wrap;
  gap: 4px;
}

/* ============================================================
 *  ボタン (パネル内)
 * ============================================================ */
.btn-small {
  padding: 2px 8px;
  font-size: 11px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}

.btn-small:hover {
  background: #f0f0f0;
}

.btn-danger {
  color: #c0392b;
  border-color: #e0a9a3;
}

.btn-danger:hover {
  background: #fdecea;
}

/* ============================================================
 *  制約定義パネル
 * ============================================================ */
.constraint-section {
  margin-bottom: 20px;
}

.constraint-section-title {
  font-size: 14px;
  margin: 0 0 8px 0;
  padding: 4px 8px;
  border-radius: 3px;
}

.constraint-section-title--hard {
  background: #fdecea;
  color: #b9320c;
}

.constraint-section-title--medium {
  background: #fff8dd;
  color: #8a7028;
}

.constraint-section-title--soft {
  background: #e6f4ea;
  color: #2d6a4f;
}

.constraint-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.constraint-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

.constraint-status {
  width: 20px;
  text-align: center;
}

.constraint-desc {
  flex: 1;
}

.constraint-weight {
  color: #888;
  font-size: 11px;
  font-family: monospace;
}

/* ============================================================
 *  配布物パネル
 * ============================================================ */
.output-form fieldset {
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 12px;
  padding: 8px 12px;
}

.output-form legend {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  padding: 0 6px;
}

.output-form label {
  display: block;
  margin: 4px 0;
  font-size: 13px;
  cursor: pointer;
}

.output-form input[type="checkbox"],
.output-form input[type="radio"] {
  margin-right: 6px;
}

.poc-info {
  background: #f5f5f5;
  border: 1px dashed #ccc;
  border-radius: 4px;
  padding: 12px;
  margin-top: 16px;
  font-size: 12px;
}

.poc-info h4 {
  margin: 0 0 6px 0;
  font-size: 13px;
  color: #555;
}

.poc-info ul {
  margin: 0;
  padding-left: 20px;
}

/* ============================================================
 *  配布物パネル ボタン
 * ============================================================ */
.output-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.output-button {
  display: inline-block;
  padding: 8px 12px;
  text-align: center;
  text-decoration: none;
}

.zip-form fieldset {
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 8px;
  padding: 8px 12px;
}

.zip-form button[type="submit"] {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

/* ============================================================
 *  時間割セル (filled / empty / violation)
 * ============================================================ */
.cell--filled {
  background: #f5f9fc;
}

.cell--filled:hover {
  background: #e8eff5;
}

.cell-subject {
  font-weight: 600;
  font-size: 14px;
  color: #1a3a52;
}

.cell-teacher {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

.cell--violation {
  background: #ffe5e5 !important;
  border: 2px solid #c0392b !important;
}

.cell--violation .cell-subject {
  color: #c0392b;
}

.cell-empty-marker {
  font-size: 20px;
  color: #ccc;
  font-weight: 300;
}

.cell--empty:hover .cell-empty-marker {
  color: #1a3a52;
}

.loading-placeholder {
  padding: 32px;
  text-align: center;
  color: #888;
  font-style: italic;
}

/* ============================================================
 *  セル編集パネル — 科目選択ボタン群
 * ============================================================ */
.assignment-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.assignment-item {
  margin-bottom: 8px;
}

.assignment-button {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}

.assignment-button:hover {
  background: #f5f9fc;
  border-color: #1a3a52;
}

.assignment-subject {
  font-weight: 600;
  font-size: 14px;
  color: #1a3a52;
}

.assignment-teacher {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.section-title {
  font-size: 13px;
  color: #555;
  margin: 12px 0 8px 0;
}

.cell-editor-actions {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.cell-editor-actions .btn-danger {
  padding: 6px 12px;
  font-size: 13px;
}

/* ============================================================
 *  ヘッダーリンク (新規プロジェクト等)
 * ============================================================ */
.header-link {
  color: #fff;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 3px;
  margin-right: 12px;
  font-size: 13px;
  transition: background 0.15s;
}

.header-link:hover {
  background: rgba(255, 255, 255, 0.15);
  text-decoration: none;
  color: #fff;
}

/* button 要素として使う場合のリセット */
button.header-link {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  font-family: inherit;
}

button.header-link:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ============================================================
 *  Project switcher (Phase 7 PR #17, 戦略 E SaaS マルチテナント)
 * ============================================================ */
.project-switcher {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  padding: 4px 8px;
  margin-right: 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  max-width: 200px;
}

.project-switcher option {
  background: #1a3a52;
  color: #fff;
}

.project-switcher:hover {
  background: rgba(255, 255, 255, 0.2);
}

.project-switcher:focus {
  outline: 2px solid #4a90c2;
  outline-offset: 1px;
}

/* ============================================================
 *  新規プロジェクト画面 (テンプレート選択)
 * ============================================================ */
.new-project-page {
  max-width: 1100px;
  margin: 32px auto;
  padding: 24px;
}

.new-header h1 {
  margin: 0 0 4px 0;
  color: #1a3a52;
}

.new-header .subtitle {
  color: #666;
  margin: 0 0 16px 0;
}

.new-header .back-link {
  color: #1a3a52;
  font-size: 13px;
}

/* 名前入力 (Phase 7 PR #18) */
.new-name-input {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 16px 20px;
  margin-top: 24px;
}

.new-name-input label {
  display: block;
  font-weight: 600;
  color: #1a3a52;
  margin-bottom: 6px;
}

.new-name-input .required {
  color: #c0392b;
}

.new-name-input .text-input {
  width: 100%;
  max-width: 600px;
  padding: 8px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 15px;
  font-family: inherit;
}

.new-name-input .text-input:focus {
  outline: 2px solid #4a90c2;
  border-color: #4a90c2;
}

.new-name-input .input-help {
  font-size: 12px;
  color: #666;
  margin: 6px 0 0 0;
}

/* 空白カード (Phase 7 PR #18) */
.blank-card-section {
  margin-top: 20px;
}

.blank-card {
  background: #fff;
  border: 2px dashed #cbd5e0;
  border-radius: 6px;
  padding: 20px;
  text-align: center;
}

.blank-card-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.blank-card h3 {
  margin: 0 0 4px 0;
  color: #1a3a52;
}

.blank-card p {
  font-size: 13px;
  color: #555;
  margin: 0 0 12px 0;
}

.template-section {
  margin-top: 24px;
}

.template-section h2 {
  margin: 0 0 12px 0;
  font-size: 17px;
  color: #1a3a52;
}

/* Import セクション (Phase 7 PR #19) */
.import-section {
  margin-top: 32px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 16px 20px;
}

.import-section h2 {
  margin: 0 0 4px 0;
  font-size: 16px;
  color: #1a3a52;
}

.import-section .import-help {
  font-size: 13px;
  color: #555;
  margin: 0 0 12px 0;
}

.import-section form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.import-section .file-input {
  font-size: 13px;
}

.import-section .text-input {
  flex: 1;
  min-width: 250px;
  padding: 6px 10px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-family: inherit;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.template-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.template-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.template-card-header {
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}

.template-card h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #1a3a52;
}

.template-notes {
  font-size: 13px;
  color: #555;
  margin: 0 0 12px 0;
  flex: 1;
}

.template-meta {
  font-size: 11px;
  color: #999;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-family: monospace;
}

.template-card .btn-primary {
  width: 100%;
}

/* ============================================================
 *  認証ページ (Phase 7、戦略 E SaaS)
 * ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: linear-gradient(135deg, #1a3a52 0%, #2c5070 100%);
}

.auth-card {
  background: #fff;
  border-radius: 8px;
  padding: 40px 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.auth-card--wide {
  max-width: 600px;
}

.auth-card h1 {
  margin: 0 0 4px 0;
  color: #1a3a52;
  font-size: 24px;
  text-align: center;
}

.auth-subtitle {
  margin: 0 0 24px 0;
  text-align: center;
  color: #888;
  font-size: 13px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: #555;
  font-weight: 500;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  margin-top: 4px;
  font-family: inherit;
}

.auth-form input:focus {
  outline: none;
  border-color: #1a3a52;
  box-shadow: 0 0 0 3px rgba(26, 58, 82, 0.1);
}

.auth-form label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-weight: normal;
}

.auth-submit {
  margin-top: 8px;
  padding: 12px;
  font-size: 15px;
}

.auth-links {
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-links a {
  color: #1a3a52;
}

.logout-link {
  color: #c0392b !important;
}

.auth-note {
  margin-top: 24px;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 4px;
  font-size: 11px;
  color: #666;
}

/* Flash messages */
.flash {
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
  font-size: 13px;
}

.flash--success {
  background: #e6f4ea;
  color: #2d6a4f;
  border-left: 3px solid #3a7d44;
}

.flash--error {
  background: #fdecea;
  color: #b9320c;
  border-left: 3px solid #c0392b;
}

.flash--info {
  background: #eaf3f9;
  color: #2c4757;
  border-left: 3px solid #1a3a52;
}

.flash--warning {
  background: #fff8dd;
  color: #8a7028;
  border-left: 3px solid #e8a838;
}

/* Profile */
.profile-info {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  margin: 16px 0 24px 0;
  font-size: 14px;
}

.profile-info dt {
  font-weight: 600;
  color: #555;
}

.profile-info dd {
  margin: 0;
}

.auth-card h2 {
  margin: 24px 0 12px 0;
  font-size: 16px;
  color: #1a3a52;
  border-top: 1px solid #eee;
  padding-top: 16px;
}

/* ============================================================
 *  About ページ
 * ============================================================ */
.about-page {
  max-width: 600px;
  margin: 64px auto;
  padding: 32px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.about-page h1 {
  margin: 0 0 8px 0;
  color: #1a3a52;
}

.about-page .tagline {
  color: #666;
  margin-bottom: 24px;
}

.about-info {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px 16px;
  margin: 24px 0;
}

.about-info dt {
  font-weight: 600;
  color: #555;
}

.about-info dd {
  margin: 0;
}
