/* ============================================================
   テーマ変数（ライト = デフォルト）
   ============================================================ */
:root {
  --bg: #FAFAFA;
  --fg: #212121;
  --fg-muted: #555;
  --surface: #ffffff;
  --surface-2: #F5F5F5;
  --border: #E0E0E0;
  --border-strong: #BDBDBD;
  --primary: #2E7D32;
  --primary-dark: #1B5E20;
  --time-col-bg: #F5F5F5;
  --time-col-fg: #555;
  --shadow: 0 4px 12px rgba(0,0,0,0.1);
}
[data-theme="dark"] {
  --bg: #121417;
  --fg: #E8EAED;
  --fg-muted: #B0B5BD;
  --surface: #1E2227;
  --surface-2: #262B31;
  --border: #353A41;
  --border-strong: #4A4F56;
  --primary: #66BB6A;
  --primary-dark: #388E3C;
  --time-col-bg: #262B31;
  --time-col-fg: #B0B5BD;
  --shadow: 0 4px 12px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
body {
  font-family: 'Hiragino Sans', 'Noto Sans JP', 'Yu Gothic', 'Meiryo', sans-serif;
  background: var(--bg);
  margin: 0;
  padding: 0;
  color: var(--fg);
  line-height: 1.4;
}
.container { max-width: 1400px; margin: 0 auto; padding: 0 18px 24px; }

/* ヘッダーバー（緑系グラデーション） */
.app-header {
  background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 50%, #388E3C 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  height: 52px;
  color: white;
  margin: 0 -18px 20px;
}
.header-logo { font-size: 22px; line-height: 1; }
.header-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: white;
}
.header-sub {
  font-size: 12px;
  opacity: 0.85;
  margin-left: auto;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.subtitle { display: none; }

/* ヘッダー内メニューボタン（半透明・緑ヘッダーに馴染む） */
.app-header .dropdown {
  margin-left: 14px;
  margin-right: 36px; /* ブログの×閉じるボタンを避ける */
  flex-shrink: 0;
}
.header-menu-btn {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.35);
  color: white;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.header-menu-btn:hover { background: rgba(255,255,255,0.3); }
/* ヘッダー右端なのでメニューは右寄せで開く */
.app-header .dropdown-menu { right: 0; left: auto; }

@media (max-width: 600px) {
  .header-sub { display: none; }
}

/* ブログ訪問者向けガイダンスバナー */
.info-banner {
  display: flex; align-items: center; gap: 12px;
  background: #FFF8E1;
  border-left: 4px solid #FFA000;
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #5D4037;
}
[data-theme="dark"] .info-banner {
  background: #2E2418;
  color: #FFD180;
  border-left-color: #FFA000;
}
.info-banner[hidden] { display: none; }
.info-icon { font-size: 18px; flex-shrink: 0; }
.info-text { flex: 1; line-height: 1.5; }
.info-close {
  background: none; border: none;
  color: inherit; cursor: pointer;
  font-size: 18px; padding: 0 4px;
  opacity: 0.6;
}
.info-close:hover { opacity: 1; }

/* タブ */
.tabs {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.tab-btn {
  padding: 10px 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-muted);
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 14px; font-weight: 600;
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
}
.tab-btn:hover { background: var(--surface-2); }
.tab-btn.active { color: white; border-bottom-color: rgba(0,0,0,0.2); }
.tab-btn.active.normal  { background: #2E7D32; }
.tab-btn.active.carrite { background: #E65100; }
.tab-btn.active.kumi    { background: #B71C1C; }

/* アクション */
.actions {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.btn {
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px; font-weight: 600;
}
.btn:hover { background: var(--surface-2); }
/* ドロップダウン（JSON エクスポート/インポート） */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 4px;
  min-width: 160px;
}
.dropdown-menu[hidden] { display: none; }
.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: #C62828; }
[data-theme="dark"] .dropdown-item.danger { color: #FF8A80; }
.dropdown-divider {
  height: 1px; background: var(--border);
  margin: 4px 0;
}

.btn-danger { color: #C62828; border-color: #EF9A9A; }
.btn-danger:hover { background: #FFEBEE; }
[data-theme="dark"] .btn-danger { color: #FF8A80; border-color: #6E2A2A; }
[data-theme="dark"] .btn-danger:hover { background: #3A1F1F; }
.save-status {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 200;
  background: #2E7D32; color: white;
  font-size: 13px; font-weight: 700;
  padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.save-status.visible { opacity: 1; transform: translateY(0); }

/* 凡例（折りたたみ式・控えめ） */
.legend-wrap { margin-bottom: 14px; }
.legend-toggle {
  background: none;
  border: none;
  padding: 2px 4px;
  font-size: 11px; font-weight: 600;
  color: var(--fg-muted);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  font-family: inherit;
  opacity: 0.75;
}
.legend-toggle:hover { opacity: 1; color: var(--primary); }
.legend-caret { transition: transform 0.2s; font-size: 9px; }
.legend-toggle.open .legend-caret { transform: rotate(180deg); }
.legend {
  display: flex; flex-wrap: wrap; gap: 10px;
  background: var(--surface);
  padding: 12px 16px; border-radius: 10px;
  margin-top: 8px;
  border: 1px solid var(--border);
  font-size: 12px;
}
.legend[hidden] { display: none; }
.legend-item { display: flex; align-items: center; gap: 6px; position: relative; }
.legend-color {
  width: 16px; height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.1);
  cursor: pointer; padding: 0;
  appearance: none; -webkit-appearance: none;
}
.legend-color::-webkit-color-swatch-wrapper { padding: 0; }
.legend-color::-webkit-color-swatch { border: none; border-radius: 3px; }
.legend-color::-moz-color-swatch { border: none; border-radius: 3px; }
.legend-item:hover .legend-color { outline: 2px solid var(--primary); outline-offset: 1px; }

/* テーブル */
.pattern-title {
  font-size: 20px; margin: 16px 0 12px;
  padding: 10px 16px; border-radius: 6px; color: white;
}
.pattern-title.normal  { background: #2E7D32; }
.pattern-title.carrite { background: #E65100; }
.pattern-title.kumi    { background: #B71C1C; }

table.schedule {
  width: 100%; border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 11px; table-layout: fixed;
}
table.schedule th, table.schedule td {
  border: 1px solid var(--border);
  padding: 4px 6px; text-align: center;
  vertical-align: middle; height: 24px; overflow: hidden;
}
table.schedule thead th {
  color: white; font-weight: 600;
  height: 32px; font-size: 13px;
}
table.schedule.normal  thead th { background: #2E7D32; }
table.schedule.carrite thead th { background: #E65100; }
table.schedule.kumi    thead th { background: #B71C1C; }
/* 見出し行の「時間」セルは他の曜日見出しと同じ色 */
table.schedule.normal  thead th.time-col { background: #2E7D32; color: white; font-size: 13px; }
table.schedule.carrite thead th.time-col { background: #E65100; color: white; font-size: 13px; }
table.schedule.kumi    thead th.time-col { background: #B71C1C; color: white; font-size: 13px; }
table.schedule tbody .time-col {
  background: var(--time-col-bg);
  color: var(--time-col-fg);
  font-weight: 600; font-size: 10px; width: 70px;
  cursor: pointer;
}
table.schedule tbody .time-col:hover { background: var(--surface-2); color: var(--primary); }
table.schedule.normal  tbody .time-col.selected { background: #2E7D32; color: white; }
table.schedule.carrite tbody .time-col.selected { background: #E65100; color: white; }
table.schedule.kumi    tbody .time-col.selected { background: #B71C1C; color: white; }

td.cell { cursor: pointer; transition: outline 0.1s, box-shadow 0.1s; }
td.cell:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
td.cell.editing { outline: 2px solid var(--primary); outline-offset: -2px; padding: 0; }
td.cell.row-highlight {
  outline: 3px solid var(--primary);
  outline-offset: -3px;
  box-shadow: inset 0 0 0 9999px rgba(0,0,0,0.04);
}
/* パターンごとに row-highlight の色をタブ色に合わせる */
.pattern-section[data-pattern="normal"]  td.cell.row-highlight { outline-color: #2E7D32; }
.pattern-section[data-pattern="carrite"] td.cell.row-highlight { outline-color: #E65100; }
.pattern-section[data-pattern="kumi"]    td.cell.row-highlight { outline-color: #B71C1C; }

.cell-editor {
  display: flex; flex-direction: column; gap: 2px;
  padding: 2px; background: var(--surface);
}
.cell-editor input,
.cell-editor select {
  font-size: 11px; padding: 2px 4px;
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--fg);
  border-radius: 3px; width: 100%;
  font-family: inherit;
}
.cell-editor input:focus,
.cell-editor select:focus {
  outline: none; border-color: var(--primary);
}

/* 画面表示で非アクティブパターンを隠す */
.hidden-on-screen { display: none; }

/* モーダル */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface); color: var(--fg);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-width: 560px; width: 100%;
  max-height: 80vh; overflow: hidden;
  display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 16px; color: var(--primary); }
.modal-close {
  background: none; border: none; font-size: 22px;
  color: var(--fg-muted); cursor: pointer; line-height: 1; padding: 0 6px;
}
.modal-close:hover { color: var(--fg); }
.modal-body { padding: 16px 18px; overflow: auto; font-size: 13px; }
.modal-body label { display: block; margin: 8px 0 4px; font-weight: 600; }
.modal-body select, .modal-body input {
  width: 100%; padding: 6px 8px; font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: 4px;
  background: var(--surface); color: var(--fg);
}
.modal-actions {
  margin-top: 16px; display: flex; gap: 8px; justify-content: flex-end;
}

/* 整合性チェック警告リスト */
/* 種別管理モーダル */
.type-list { margin: 0; padding: 0; list-style: none; }
.type-list li {
  display: grid;
  grid-template-columns: 32px 1fr 90px 30px;
  gap: 8px; align-items: center;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}
.type-list li:last-child { border-bottom: none; }
.type-list input[type="text"] {
  font-size: 13px; padding: 4px 6px;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: 3px;
}
.type-list input[type="range"] { width: 100%; }
.type-list .type-color {
  width: 28px; height: 28px;
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--border-strong); border-radius: 4px;
  cursor: pointer; padding: 0;
}
.type-list .type-color::-webkit-color-swatch-wrapper { padding: 0; }
.type-list .type-color::-webkit-color-swatch { border: none; border-radius: 4px; }
.type-list .type-delete {
  background: none; border: none;
  color: #C62828; cursor: pointer;
  font-size: 16px; padding: 4px;
}
.type-list .type-delete:hover { color: #B71C1C; }
.type-add-row {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.type-list-header {
  display: grid;
  grid-template-columns: 32px 1fr 90px 30px;
  gap: 8px; padding: 4px 4px;
  font-size: 11px; color: var(--fg-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.warning-list { margin: 0; padding: 0; list-style: none; }
.warning-list li {
  padding: 8px 12px; margin-bottom: 6px;
  border-left: 3px solid #FFA000;
  background: #FFF8E1; color: #5D4037;
  border-radius: 3px; font-size: 13px;
}
[data-theme="dark"] .warning-list li {
  background: #3A2E14; color: #FFD180; border-left-color: #FFA000;
}
.warning-list li.ok {
  border-left-color: #4CAF50;
  background: #E8F5E9; color: #2E7D32;
}
[data-theme="dark"] .warning-list li.ok {
  background: #1E3320; color: #A5D6A7;
}

/* ============================================================
   ダッシュボード
   ============================================================ */
#dashboardView { padding: 0 18px; }

/* KPI サマリーカード */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.04);
}
.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
  flex-shrink: 0;
}
[data-theme="dark"] .kpi-icon { background: linear-gradient(135deg, #1E3320, #2E4630); }
.kpi-main { min-width: 0; }
.kpi-value {
  font-size: 28px; font-weight: 800; line-height: 1.1;
  color: var(--fg); letter-spacing: -0.02em;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.kpi-delta { font-size: 13px; font-weight: 700; }
.kpi-delta.up { color: #2E7D32; }
.kpi-delta.down { color: #C62828; }
.kpi-label {
  font-size: 12px; color: var(--fg-muted); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.dash-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 26px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.04);
}
.dash-section h2 {
  margin: 0 0 6px;
  font-size: 19px;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.dash-section .dash-desc {
  margin: 0 0 18px;
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.6;
}
.dash-toolbar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.dash-toolbar label { font-size: 13px; font-weight: 600; color: var(--fg-muted); }
.dash-toolbar select {
  padding: 7px 12px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--fg);
  font-weight: 600;
}
.dash-toolbar .btn { border-radius: 10px; }

/* 教科別勉強時間バー */
.studytime-total {
  font-size: 14px; font-weight: 600; margin-bottom: 18px;
  color: var(--fg-muted);
}
.studytime-total span { color: var(--primary); font-size: 24px; font-weight: 800; }
.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 56px;
  align-items: center; gap: 12px;
  margin-bottom: 10px; font-size: 13px;
}
.bar-label { text-align: right; font-weight: 600; }
.bar-track {
  background: var(--surface-2);
  border-radius: 999px; height: 14px; overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 999px;
  min-width: 4px; transition: width 0.4s ease;
}
.bar-value { font-weight: 700; color: var(--fg-muted); text-align: right; }

/* テスト入力フォーム */
.test-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 10px; align-items: end;
  margin-bottom: 16px;
}
.test-form .field { display: flex; flex-direction: column; gap: 4px; }
.test-form label { font-size: 11px; font-weight: 600; color: var(--fg-muted); }
.test-form input, .test-form select {
  padding: 6px 8px; font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); color: var(--fg);
}
.test-form .add-btn {
  background: #2E7D32; color: white;
  font-weight: 700; cursor: pointer;
  padding: 8px 12px; border-radius: 6px; border: 1px solid #1B5E20;
}
.test-form .add-btn:hover { background: #1B5E20; }

/* テスト結果テーブル */
.test-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.test-table th, .test-table td {
  border: 1px solid var(--border);
  padding: 6px 8px; text-align: center;
}
.test-table th { background: var(--surface-2); font-weight: 600; }
.test-table .del-btn {
  background: none; border: none; color: #C62828;
  cursor: pointer; font-size: 14px; padding: 2px 6px;
}
.test-empty { font-size: 13px; color: var(--fg-muted); padding: 12px 0; }

.test-table .cell-dev { font-size: 10px; color: var(--fg-muted); margin-top: 2px; }
.test-table .cell-rate { font-size: 11px; color: var(--primary); font-weight: 700; }
.test-subj-max { background: var(--surface-2) !important; }

/* テスト編集モーダル */
.test-edit-form .field {
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 10px;
}
.test-edit-form .field label {
  font-size: 11px; font-weight: 600; color: var(--fg-muted);
}
.test-edit-form .field input,
.test-edit-form .field select {
  padding: 6px 8px; font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); color: var(--fg);
}
.test-edit-form .test-subj-grid { margin-bottom: 10px; }

/* 計測対象設定モーダル */
.studymap-list { max-height: 50vh; overflow-y: auto; }
.studymap-item { border-bottom: 1px solid var(--border); padding: 8px 2px; }
.studymap-item:last-child { border-bottom: none; }
.studymap-row {
  display: grid;
  grid-template-columns: 24px 1fr 170px;
  gap: 10px; align-items: center;
}
.studymap-sw {
  width: 24px; height: 24px; border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
}
.studymap-name { font-size: 13px; }
.studymap-row select {
  padding: 5px 8px; font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); color: var(--fg);
}
.studymap-weights {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 8px; padding: 8px 10px;
  background: var(--surface-2); border-radius: 6px;
}
.studymap-weights[hidden] { display: none; }
.weight-field {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 11px; color: var(--fg-muted); font-weight: 600;
}
.weight-field input {
  width: 56px; padding: 4px 6px; font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: 4px;
  background: var(--surface); color: var(--fg);
}

/* 円グラフ */
.pie-row {
  display: flex; flex-wrap: wrap; gap: 28px;
  margin-top: 12px; padding-top: 16px;
  border-top: 1px dashed var(--border);
}
.pie-box { flex: 1 1 380px; min-width: 300px; }
.pie-title { margin: 0 0 12px; font-size: 15px; color: var(--fg); }
.pie-day-control {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 0 0;
}
.pie-day-control label { font-size: 12px; font-weight: 600; color: var(--fg-muted); }
.pie-day-control select {
  padding: 5px 10px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--fg);
}
.pie-chart-row {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.pie-svg { width: 220px; height: 220px; flex-shrink: 0; }
.pie-legend {
  flex: 1; min-width: 160px;
  display: grid; grid-template-columns: 1fr; gap: 6px;
  font-size: 13px;
}
.pie-li { display: flex; align-items: center; gap: 8px; padding: 2px 4px; border-radius: 6px; }
.pie-li .cdot { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }
.pie-li-label { flex: 1; }
.pie-li-val { font-weight: 700; color: var(--fg-muted); }
.pie-li.clickable { cursor: pointer; }
.pie-li.clickable:hover { background: var(--surface-2); }
.pie-li-more { font-size: 11px; color: var(--primary); font-weight: 700; }

/* 按分の割合合計表示 */
.weight-total {
  align-self: flex-end; font-size: 12px; font-weight: 700;
  color: var(--fg-muted); margin-left: 4px;
}
.weight-total.warn { color: #E65100; }

/* テスト入力：教科ごとに点数・偏差値を縦に */
.test-subj-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}
.test-subj-col {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface-2);
  border-radius: 8px; padding: 8px 10px;
}
.test-subj-head {
  font-size: 13px; font-weight: 700; text-align: center;
  color: var(--fg);
}
.test-subj-col input {
  padding: 6px 8px; font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); color: var(--fg);
}

/* 折れ線グラフ */
.chart-wrap { overflow-x: auto; }
.chart-wrap svg { display: block; max-width: 100%; }
.chart-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 12px; margin-top: 8px;
}
.chart-legend .ci { display: flex; align-items: center; gap: 5px; }
.chart-legend .cdot { width: 12px; height: 12px; border-radius: 50%; }

/* スマホ縦リスト用 */
.schedule-mobile { display: none; }
.mobile-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}
.mobile-day-header {
  padding: 10px 14px;
  font-weight: 600; font-size: 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.mobile-block {
  display: flex; align-items: stretch;
  border-top: 1px solid var(--border);
}
.mobile-block:first-child { border-top: none; }
.mobile-block-time {
  flex: 0 0 84px;
  padding: 8px 10px;
  background: var(--time-col-bg);
  color: var(--time-col-fg);
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center;
}
.mobile-block-content {
  flex: 1; padding: 8px 12px;
  font-size: 13px;
  display: flex; align-items: center;
  cursor: pointer;
}

/* レスポンシブ：768px 以下ではテーブルを隠して縦リスト */
@media (max-width: 768px) {
  body { padding: 12px; }
  .schedule-grid { display: none; }
  .schedule-mobile { display: block; }
  .legend { font-size: 11px; }
  .actions { gap: 6px; }
  .btn { padding: 6px 10px; font-size: 12px; }
}

/* 印刷レイアウト */
@media print {
  @page { size: A3 landscape; margin: 10mm; }
  /* 背景色・背景画像を印刷に反映させる */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body { padding: 0; background: white; color: #212121; }
  .container { max-width: 100%; }
  .tabs, .actions, #appSubtitle, .schedule-mobile, .info-banner, #menuDropdown {
    display: none !important;
  }
  .app-header { margin-bottom: 8px; }
  .legend-toggle { display: none !important; }
  .legend, .legend[hidden] {
    display: flex !important;
    margin-bottom: 10px; border: 1px solid #BDBDBD;
    page-break-inside: avoid; background: white;
  }
  .legend-color { cursor: default; outline: none !important; }
  .hidden-on-screen { display: block !important; }
  .pattern-section { page-break-before: always; }
  .pattern-section:first-of-type { page-break-before: auto; }
  table.schedule { font-size: 10px; background: white; }
  table.schedule td, table.schedule th { height: 20px; padding: 2px 4px; }
  td.cell { cursor: default; }
  td.cell:hover { outline: none; }
  .schedule-grid { display: block; }
}
