/* ===== スケジュール =====
   色は app.css の変数（--c-*）か、ここで定義する --sch-* を使う（直書きしない）。
   文字: 12px 未満は使わない。12px は太字の短いラベル（種別ラベルなど）だけ。日時・目盛り・件数・補足は 13px 以上。
   予定表の表（グループ週・グループ日・個人日・個人週・個人月）の中は、スマホの幅でも 14px のまま（.sch-gw など）。
   太さは 400 と 700 だけ。 */
:root {
  --sch-sat-bg: #f3f8ff;      /* 土曜の列 */
  --sch-sun-bg: #fff5f5;      /* 日曜・祝日の列 */
  --sch-today-bg: #fffbe8;    /* 今日の列 */
  --sch-sat-head: #e9f2fe;    /* 見出しの土曜（--c-sat の文字で 4.80:1） */
  --sch-sun-head: #fdeaea;    /* 見出しの日曜・祝日（--c-sun の文字で 4.72:1） */
  --sch-today-head: #fff3c4;  /* 見出しの今日（--c-sun 4.91:1・--c-sat 4.87:1） */
  --sch-self-bg: #f2f7ff;     /* 自分の行 */
  --sch-line: #e6ebf1;        /* 表の罫線 */
  --sch-name-w: 176px;
  --sch-mc-none: var(--c-text-disabled);  /* 種別なしの予定の左端の色（飾り。文字には使わない） */
  /* 伏せた予定（予定あり）の斜線。--c-text-2 の文字で 4.93:1 以上 */
  --sch-masked-bg: repeating-linear-gradient(135deg, var(--c-surface-2) 0 6px, var(--sch-line) 6px 12px);
}
/* 読み上げだけに使う文字（見た目には出さない） */
.sch-sr {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---- ページ上部・表示切替・ツールバー ---- */
.sch-head { margin-bottom: 10px; }
.sch-views { display: flex; gap: 2px; border-bottom: 1px solid var(--c-border); margin-bottom: 12px; overflow-x: auto; scrollbar-width: thin; }
.sch-views a {
  padding: 8px 14px; color: var(--c-text-2); font-size: 14px; font-weight: 700; border-bottom: 3px solid transparent; white-space: nowrap;
}
.sch-views a:hover { color: var(--c-text); text-decoration: none; background: var(--c-surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.sch-views a.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
/* 横スクロールの枠で輪郭の上下が切れないよう、内側に出す */
.sch-views a:focus-visible { outline-offset: -2px; }
.sch-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.sch-select { min-width: 180px; max-width: 280px; }
.sch-datenav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sch-date { height: 28px; min-height: 28px; padding: 2px 8px; font-size: 13px; }
.sch-curdate { font-size: 15px; padding: 2px 4px; background: none !important; }
.sch-curdate.sch-sun { color: var(--c-sun); }
.sch-curdate.sch-sat { color: var(--c-sat); }
.sch-hol-inline { margin-left: 8px; font-size: 13px; color: var(--c-sun); font-weight: 700; }
.sch-card { overflow: hidden; }
.sch-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* 左端に固定した名前の列の下に、フォーカスした予定が隠れないように */
.sch-gtable .sch-scroll { scroll-padding-left: var(--sch-name-w); }
.sch-i { width: 13px; height: 13px; flex: none; vertical-align: -2px; }

/* ---- 予定の種別の色ラベル・凡例 ---- */
.sch-menu {
  display: inline-block; flex: none; padding: 0 5px; border-radius: 3px; font-size: 12px; font-weight: 700; line-height: 17px;
  color: #fff; background: var(--mc, var(--c-text-2)); vertical-align: 1px; white-space: nowrap;
}
.sch-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 10px; font-size: 13px; color: var(--c-text-2); }
.sch-legend-label { font-weight: 700; }
.sch-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.sch-legend-item i { width: 12px; height: 12px; border-radius: 3px; background: var(--mc); }
.sch-legend-edit { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-weight: 700; }
.sch-legend-edit .ico { width: 14px; height: 14px; }

/* ---- 予定 1 件（チップ） ---- */
.sch-ev {
  --mc: var(--sch-mc-none);
  display: block; position: relative; min-height: 24px; margin: 0 0 3px; padding: 3px 6px 3px 7px; border-radius: 4px;
  border-left: 3px solid var(--mc); background: color-mix(in srgb, var(--mc) 9%, var(--c-surface));
  color: var(--c-text); font-size: 13px; line-height: 1.4; word-break: break-word; cursor: pointer;
  transition: background .12s, box-shadow .12s;
}
a.sch-ev:hover { text-decoration: none; background: color-mix(in srgb, var(--mc) 18%, var(--c-surface)); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.sch-ev > * { margin-right: 3px; }
/* 時刻は太字で区別する（濃い種別の色を混ぜた背景でも 4.5:1 を保つため、灰色にはしない） */
.sch-ev-time { font-weight: 700; color: var(--c-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sch-ev-title { font-weight: 400; }
.sch-ev .sch-i { color: var(--c-text-3); }
.sch-allday { background: color-mix(in srgb, var(--mc) 16%, var(--c-surface)); }
.sch-period {
  border-left: 0; padding-left: 8px; background: color-mix(in srgb, var(--mc) 22%, var(--c-surface)); border-radius: 4px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mc) 30%, transparent);
}
.sch-period.sch-p-cont { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.sch-period:not(.sch-p-end) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.sch-ev-cont { color: var(--c-text); }
.sch-masked {
  border-left: 3px solid var(--c-border-strong); background: var(--sch-masked-bg);
  color: var(--c-text-2); cursor: default;
}
.sch-conflict { box-shadow: inset 0 0 0 1px var(--c-warn); }
.sch-warn {
  display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%;
  background: var(--c-warn); color: #fff; font-size: 12px; font-weight: 700; line-height: 1; vertical-align: 0;
}
.sch-dragging { opacity: .45; }
.sch-drop { outline: 2px dashed var(--c-primary); outline-offset: -2px; background: var(--c-primary-weak) !important; }
body.sch-is-dragging .sch-add { display: none; }

/* ---- 日付の色分け ---- */
.sch-sat { background: var(--sch-sat-bg); }
.sch-sun { background: var(--sch-sun-bg); }
.sch-today { background: var(--sch-today-bg); }
.sch-hol { font-size: 13px; color: var(--c-sun); font-weight: 700; line-height: 1.3; }

/* ---- 行の見出し（人・組織） ---- */
.sch-rowhead { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sch-rowname { min-width: 0; display: flex; flex-direction: column; }
.sch-rowname a { color: var(--c-text); font-weight: 700; }
.sch-rowsub { font-size: 13px; color: var(--c-text-3); font-weight: 400; }
.sch-rowicon {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--c-surface-2); border: 1px solid var(--c-border); color: var(--c-text-2);
}
.sch-rowicon .ico { width: 13px; height: 13px; }

/* ---- グループ週 ---- */
.sch-gw { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 14px; }
.sch-gw th, .sch-gw td { border-right: 1px solid var(--sch-line); border-bottom: 1px solid var(--sch-line); }
.sch-gw thead th { position: sticky; top: 0; z-index: 2; background: var(--c-surface-2); }
.sch-corner { width: var(--sch-name-w); text-align: left; padding: 8px 10px; font-size: 13px; font-weight: 700; color: var(--c-text-2); left: 0; z-index: 3 !important; }
.sch-dayhead { padding: 6px 4px; text-align: center; font-size: 13px; font-weight: 700; }
.sch-dayhead a { color: inherit; }
.sch-dayhead.sch-sat { background: var(--sch-sat-head) !important; color: var(--c-sat); }
.sch-dayhead.sch-sun { background: var(--sch-sun-head) !important; color: var(--c-sun); }
.sch-dayhead.sch-today { background: var(--sch-today-head) !important; box-shadow: inset 0 3px 0 var(--c-primary); }
.sch-namecell {
  position: sticky; left: 0; z-index: 1; background: var(--c-surface); text-align: left; vertical-align: top; padding: 8px 10px; font-weight: 400;
}
.sch-self .sch-namecell { background: var(--sch-self-bg); }
/* 下の余白は「＋」（24px）の場所。タッチ端末では「＋」を出さず、この空いている所を押して登録する */
.sch-cell { position: relative; vertical-align: top; padding: 4px 4px 28px; height: 64px; }
.sch-cell.sch-can-add { cursor: cell; }
.sch-cell.sch-can-add .sch-ev { cursor: pointer; }
.sch-cellbody { min-height: 32px; }
.sch-add {
  position: absolute; right: 3px; bottom: 2px; display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0; border: 1px solid var(--c-border); border-radius: 50%; background: var(--c-surface); color: var(--c-primary);
  cursor: pointer; opacity: 0; transition: opacity .12s;
}
.sch-add .ico { width: 16px; height: 16px; }
.sch-cell:hover .sch-add, .sch-add:focus-visible { opacity: 1; }
.sch-add:hover { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
@media (hover: none) { .sch-add { opacity: 1; } }

/* ---- グループ日（横の時間軸） ---- */
.sch-gd { display: grid; grid-template-columns: var(--sch-name-w) minmax(calc(var(--hours) * 52px), 1fr); font-size: 14px; }
.sch-gd-head { position: sticky; top: 0; z-index: 2; background: var(--c-surface-2); border-bottom: 1px solid var(--c-border); height: 30px; }
.sch-gd-head.sch-gd-name { left: 0; z-index: 3; padding: 6px 10px; font-size: 13px; font-weight: 700; line-height: 18px; color: var(--c-text-2); }
.sch-gd-scale { position: relative; }
.sch-gd-scale span { position: absolute; top: 6px; padding-left: 4px; font-size: 13px; color: var(--c-text-3); font-variant-numeric: tabular-nums; border-left: 1px solid var(--c-border-strong); line-height: 18px; }
.sch-gd-name {
  position: sticky; left: 0; z-index: 1; background: var(--c-surface); padding: 6px 10px; border-right: 1px solid var(--sch-line); border-bottom: 1px solid var(--sch-line);
}
.sch-gd-name.sch-self { background: var(--sch-self-bg); }
.sch-gd-allday { margin-top: 4px; }
.sch-gd-track {
  position: relative; min-height: 34px; border-bottom: 1px solid var(--sch-line);
  background-image: repeating-linear-gradient(to right, var(--sch-line) 0 1px, transparent 1px calc(100% / var(--hours)));
}
.sch-gd-track.sch-can-add { cursor: cell; }
.sch-bar {
  --mc: var(--sch-mc-none);
  position: absolute; display: flex; align-items: center; gap: 4px; height: 22px; padding: 0 6px; overflow: hidden; white-space: nowrap;
  border-radius: 4px; border-left: 3px solid var(--mc); background: color-mix(in srgb, var(--mc) 14%, var(--c-surface));
  color: var(--c-text); font-size: 13px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--mc) 25%, transparent);
}
a.sch-bar:hover { text-decoration: none; background: color-mix(in srgb, var(--mc) 24%, var(--c-surface)); z-index: 1; }
.sch-bar-time { font-weight: 700; color: var(--c-text); font-size: 13px; font-variant-numeric: tabular-nums; }
.sch-bar-title { overflow: hidden; text-overflow: ellipsis; }
.sch-bar.sch-masked { border-left-color: var(--c-border-strong); box-shadow: none; }
/* 時間が重なる予定（.sch-bar の影より後に書かないと消える） */
.sch-bar.sch-conflict { box-shadow: inset 0 0 0 1px var(--c-warn); }

/* ---- 個人日・個人週（縦の時間軸） ---- */
/* scroll-padding: 上に固定した日付の見出しと左の時刻の目盛りの下に、フォーカスした予定が隠れないように */
.sch-tg-scroll { max-height: calc(100vh - 250px); min-height: 360px; overflow: auto; scroll-padding: 48px 0 0 52px; }
.sch-tg { display: grid; grid-template-columns: 52px repeat(var(--cols), minmax(0, 1fr)); font-size: 14px; }
.sch-tg-week { min-width: 820px; }
.sch-tg-corner, .sch-tg-dayhead { position: sticky; top: 0; z-index: 3; background: var(--c-surface-2); border-bottom: 1px solid var(--c-border); }
.sch-tg-corner { left: 0; z-index: 4; }
.sch-tg-dayhead { padding: 6px 4px; text-align: center; font-weight: 700; font-size: 13px; border-left: 1px solid var(--sch-line); }
.sch-tg-dayhead a { color: inherit; }
.sch-tg-dayhead.sch-sat { background: var(--sch-sat-head); color: var(--c-sat); }
.sch-tg-dayhead.sch-sun { background: var(--sch-sun-head); color: var(--c-sun); }
.sch-tg-dayhead.sch-today { background: var(--sch-today-head); box-shadow: inset 0 3px 0 var(--c-primary); }
.sch-tg-alllabel { position: sticky; left: 0; z-index: 2; background: var(--c-surface); font-size: 13px; color: var(--c-text-3); text-align: right; padding: 6px 6px 0 0; border-bottom: 2px solid var(--c-border); }
.sch-tg-allday { padding: 3px; min-height: 34px; border-left: 1px solid var(--sch-line); border-bottom: 2px solid var(--c-border); }
.sch-tg-scale { position: sticky; left: 0; z-index: 2; background: var(--c-surface); border-right: 1px solid var(--sch-line); }
.sch-tg-scale span { position: absolute; right: 6px; margin-top: 2px; font-size: 13px; color: var(--c-text-3); font-variant-numeric: tabular-nums; }
.sch-tg-col {
  position: relative; border-left: 1px solid var(--sch-line);
  background-image: repeating-linear-gradient(to bottom, var(--sch-line) 0 1px, transparent 1px var(--hourpx));
}
.sch-tg-col.sch-sat, .sch-tg-col.sch-sun, .sch-tg-col.sch-today { background-image: repeating-linear-gradient(to bottom, var(--sch-line) 0 1px, transparent 1px var(--hourpx)); }
.sch-tg-col.sch-can-add { cursor: cell; }
/* 30 分の予定（高さ 20px）でも 13px の文字が切れないよう、上下の余白と行の高さを詰める */
.sch-block { flex-wrap: wrap; align-content: flex-start; align-items: flex-start; white-space: normal; height: auto; padding: 1px 5px; line-height: 1.3; gap: 0 4px; }
.sch-block .sch-bar-title { white-space: normal; word-break: break-word; }
.sch-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--c-danger); z-index: 2; pointer-events: none; }
.sch-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-danger); }
.sch-tg-empty { padding: 8px 12px; border-top: 1px solid var(--c-border); }

/* ---- 個人月 ---- */
.sch-month-wrap { min-width: 720px; font-size: 14px; }
.sch-month-head, .sch-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.sch-month-head div { padding: 6px; text-align: center; font-size: 13px; font-weight: 700; color: var(--c-text-2); background: var(--c-surface-2); border-bottom: 1px solid var(--c-border); }
.sch-month-head .sch-sun { color: var(--c-sun); background: var(--sch-sun-head); }
.sch-month-head .sch-sat { color: var(--c-sat); background: var(--sch-sat-head); }
.sch-mcell { min-height: 112px; padding: 4px; border-right: 1px solid var(--sch-line); border-bottom: 1px solid var(--sch-line); }
.sch-mcell.sch-can-add { cursor: cell; }
/* 前後の月の日: 薄くする（opacity）と文字が 4.5:1 を下回るので、背景と日付の色で区別する */
.sch-mcell.sch-out { background: var(--c-surface-2); }
.sch-mday { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; min-width: 0; }
.sch-mday a { font-weight: 700; color: var(--c-text); }
.sch-mcell.sch-sun .sch-mday a { color: var(--c-sun); }
.sch-mcell.sch-sat .sch-mday a { color: var(--c-sat); }
.sch-mcell.sch-out:not(.sch-today) .sch-mday a { color: var(--c-text-3); font-weight: 400; }
.sch-mcell.sch-today .sch-mday a { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 11px; background: var(--c-primary); color: #fff; }
.sch-more { font-size: 13px; }

/* ---- 予定の詳細 ---- */
.sch-detail-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.sch-detail-head { flex-wrap: wrap; border-top: 4px solid var(--mc, var(--c-border)); border-radius: var(--radius) var(--radius) 0 0; }
.sch-detail-head h2 { font-size: 18px; margin-right: auto; word-break: break-word; }
.sch-detail-head .sch-menu { font-size: 13px; line-height: 20px; padding: 0 8px; }
.sch-actions { margin-bottom: 14px; }
.sch-dl { display: grid; grid-template-columns: 110px minmax(0, 1fr); margin: 0; }
.sch-dl dt, .sch-dl dd { padding: 10px 0; border-top: 1px solid var(--c-border); }
.sch-dl dt { color: var(--c-text-2); font-weight: 700; font-size: 13px; }
.sch-dl dd { margin: 0; min-width: 0; }
.sch-when { font-size: 15px; font-weight: 700; }
.sch-people { display: flex; flex-wrap: wrap; gap: 6px; }
.sch-person { color: var(--c-text); padding: 2px 10px 2px 3px; }
.sch-person:hover { text-decoration: none; border-color: var(--c-primary); }
.sch-company { display: flex; flex-direction: column; gap: 2px; }
.sch-memo { line-height: 1.7; }
.sch-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sch-files li { display: flex; align-items: center; gap: 4px; }
.sch-conflicts { margin-bottom: 12px; font-size: 13px; }
.sch-conflicts ul { margin: 4px 0 0; padding-left: 20px; }
.sch-comments li { padding: 12px 16px; }
.sch-comment-body { margin: 6px 0 0 30px; }

/* ---- 登録・変更 ---- */
.sch-form { max-width: 980px; }
.sch-form .card-body.form { gap: 18px; }
.sch-seg { flex-wrap: wrap; }
.sch-when-box { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface-2); }
.sch-when-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sch-when-row .input, .sch-when-row .select { background: var(--c-surface); }
.sch-lbl { width: 52px; flex: none; font-size: 13px; color: var(--c-text-2); font-weight: 700; }
.sch-time { display: inline-flex; gap: 2px; }
.sch-hour, .sch-min { min-width: 74px; }
.sch-menu-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.sch-pill {
  --mc: var(--c-text-2);
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 12px; border: 1px solid var(--c-border-strong); border-radius: 999px;
  background: var(--c-surface); color: var(--c-text); font-size: 13px; cursor: pointer;
}
.sch-pill i { width: 10px; height: 10px; border-radius: 50%; background: var(--mc); }
.sch-pill:hover { border-color: var(--mc); }
.sch-pill.active { background: color-mix(in srgb, var(--mc) 16%, var(--c-surface)); border-color: var(--mc); font-weight: 700; box-shadow: 0 0 0 1px var(--mc); }
.sch-company-box summary { cursor: pointer; color: var(--c-primary); padding-top: 6px; }
.sch-2col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 6px; }
.sch-file-input { display: none; }
.sch-form .sch-files { margin-bottom: 8px; }
.sch-form-foot { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 8px; box-shadow: 0 -4px 12px rgba(16, 24, 40, .06); }
.sch-scope-opt { padding: 6px 8px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); }
.sch-scope-opt:has(input:checked) { border-color: var(--c-primary); background: var(--c-primary-weak); }

/* ---- 管理: 予定の種別の色（白い文字が読める 9 色の見本から選ぶ） ---- */
.sch-menu-edit { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.sch-swatches { min-width: 0; margin: 0; padding: 0; border: 0; }
.sch-swatches-label { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--c-text-2); }
.sch-swatches-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px; }
.sch-swatch-opt { position: relative; display: inline-flex; cursor: pointer; }
/* ラジオボタンは見えなくして（フォーカスと矢印キーの操作は残る）、色の見本に状態を出す */
.sch-swatch-opt input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.sch-swatch {
  display: inline-flex; align-items: center; gap: 3px; min-height: 28px; padding: 0 12px; border-radius: 999px;
  background: var(--mc); color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.sch-swatch .ico { display: none; width: 14px; height: 14px; stroke-width: 2.6; }
/* 選んでいる色: 濃い輪（色だけに頼らない）とチェックの印 */
.sch-swatch-opt input:checked + .sch-swatch { box-shadow: 0 0 0 2px var(--c-surface), 0 0 0 4px var(--c-text); }
.sch-swatch-opt input:checked + .sch-swatch .ico { display: inline-block; }
.sch-swatch-opt input:focus-visible + .sch-swatch { outline: 2px solid var(--c-focus); outline-offset: 5px; }
.sch-swatch-now { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 13px; color: var(--c-text-2); }
.sch-swatch-now i { flex: none; width: 16px; height: 16px; border-radius: 4px; background: var(--mc); }

/* ---- トップページの部品 ---- */
.sch-widget-title { color: var(--c-text); }
.sch-widget-list > li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 16px; }
.sch-widget-list > li.sch-sat, .sch-widget-list > li.sch-sun { background: none; }
.sch-widget-list > li.sch-today { background: var(--sch-today-bg); }
.sch-wdate { display: flex; flex-direction: column; align-items: center; width: 44px; flex: none; color: var(--c-text); line-height: 1.2; padding-top: 2px; }
.sch-wdate:hover { text-decoration: none; }
.sch-wnum { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.sch-wdow { font-size: 13px; color: var(--c-text-3); }
.sch-wday.sch-sun .sch-wdate { color: var(--c-sun); }
.sch-wday.sch-sat .sch-wdate { color: var(--c-sat); }
.sch-wday.sch-today .sch-wdow { color: var(--c-primary); font-weight: 700; }
.sch-wevents { flex: 1; min-width: 0; padding-top: 1px; }
.sch-wevents .sch-ev:last-child { margin-bottom: 0; }

/* ---- スマホのグループ予定（幅 720px 以下で、表の代わりに 1 日 × メンバーのリスト） ----
   HTML はサーバーが出す（inc/schedule/view.php の sch_day_list）。.sch-is-list のときだけ、幅 720px 以下で表と入れ替える。 */
.sch-sp, .sch-layout-switch { display: none; }
.sch-sp { font-size: 16px; }
/* 1 段目に日付の見出し、2 段目に前日・今日・翌日（幅いっぱいに 3 等分） */
.sch-sp-head { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-bottom: 1px solid var(--c-border); background: var(--c-surface-2); }
.sch-sp-date { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 18px; }
.sch-sp-date.sch-sp-sun { color: var(--c-sun); }
.sch-sp-date.sch-sp-sat { color: var(--c-sat); }
.sch-sp-date .sch-hol-inline { margin-left: 0; }
.sch-sp-nav { display: flex; }
.sch-sp-nav .btn { flex: 1 1 0; gap: 2px; padding: 0 8px; font-size: 15px; }
.sch-sp-nav .ico { width: 16px; height: 16px; }
.sch-sp-list { list-style: none; margin: 0; padding: 0; }
.sch-sp-row { padding: 10px 12px 12px; border-bottom: 1px solid var(--c-border); }
.sch-sp-row:last-child { border-bottom: 0; }
.sch-sp-row.sch-self { background: var(--sch-self-bg); }
.sch-sp-who { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.sch-sp-name { display: flex; flex-direction: column; justify-content: center; min-width: 0; min-height: 36px; margin-right: auto; line-height: 1.35; }
.sch-sp-name:hover { text-decoration: none; }
.sch-sp-name:hover .sch-sp-nm { text-decoration: underline; }
.sch-sp-nm { font-weight: 700; }
.sch-sp-name .sch-rowsub { font-size: 14px; }
.sch-sp-add { flex: none; color: var(--c-primary); }
.sch-sp-evs { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sch-sp-ev {
  --mc: var(--sch-mc-none);
  display: grid; grid-template-columns: 6.2em minmax(0, 1fr); align-items: center; gap: 2px 10px;
  min-height: 44px; padding: 6px 10px 6px 9px; border-left: 3px solid var(--mc); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--mc) 9%, var(--c-surface)); color: var(--c-text); line-height: 1.45; word-break: break-word;
}
a.sch-sp-ev:hover { text-decoration: none; background: color-mix(in srgb, var(--mc) 16%, var(--c-surface)); }
.sch-sp-ev.sch-masked { border-left-color: var(--c-border-strong); background: var(--sch-masked-bg); color: var(--c-text-2); }
.sch-sp-time { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sch-sp-main > * { margin-right: 6px; }
.sch-sp-main .sch-menu { font-size: 13px; line-height: 20px; padding: 0 6px; vertical-align: 2px; }
.sch-sp-main .sch-i { width: 16px; height: 16px; color: var(--c-text-3); vertical-align: -3px; }
.sch-sp-none { margin: 4px 0 0; color: var(--c-text-2); font-size: 15px; }

/* ---- 画面幅が狭いとき ---- */
@media (max-width: 840px) {
  .sch-detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  :root { --sch-name-w: 112px; }
  .sch-toolbar { gap: 6px; }
  .sch-select { min-width: 0; max-width: 100%; flex: 1 1 160px; }
  .sch-datenav { width: 100%; }
  .sch-gw { min-width: 760px; }
  .sch-rowhead .avatar { display: none; }
  .sch-rowhead .sch-rowicon { display: none; }
  .sch-dl { grid-template-columns: minmax(0, 1fr); }
  .sch-dl dt { padding-bottom: 0; }
  .sch-dl dd { border-top: 0; padding-top: 2px; }
  .sch-2col { grid-template-columns: minmax(0, 1fr); }
  .sch-lbl { width: 100%; }
  /* 表の外（リスト・詳細・フォーム・トップの部品）の本文と入力欄は 16px（予定表の表の中は 14px のまま） */
  .sch-date { height: auto; min-height: 36px; font-size: 16px; }
  .sch-curdate { font-size: 16px; }
  .sch-dl dd, .sch-memo, .sch-comment-body, .sch-conflicts { font-size: 16px; }
  .sch-when { font-size: 16px; }
  .sch-pill { font-size: 16px; }
  .sch-widget-list .sch-ev { font-size: 16px; }
  .sch-widget-list .sch-menu { font-size: 13px; line-height: 20px; }
  .sch-wnum { font-size: 16px; }
  /* グループ表示: リストのとき（既定）は表・時刻の範囲・表の日付の移動を隠し、リストを出す */
  .sch-layout-switch { display: inline-flex; }
  .sch-is-list .sch-sp { display: block; }
  .sch-is-list .sch-gtable, .sch-is-list .sch-full, .sch-is-list .sch-curdate, .sch-is-list .sch-datenav .btn-group { display: none; }
}

/* ---- タッチ端末（指で押す大きさ。画面の幅ではなく入力方法で切り替える） ---- */
@media (pointer: coarse) {
  /* セルの「＋」は出さない。セル（月表示は日付の欄）の空いている所を押すと登録画面が開く（schedule.js） */
  .sch-add { display: none; }
  .sch-views a { display: inline-flex; align-items: center; min-height: 44px; }
  .sch-date { min-height: 44px; }
  .sch-legend-edit { min-height: 44px; }
  .sch-menu-pills { gap: 8px; }
  .sch-pill { min-height: 44px; padding: 0 14px; }
  .sch-swatch { min-height: 44px; padding: 0 14px; }
  .sch-company-box summary { padding: 12px 0; }
  .sch-scope-opt { min-height: 48px; }
  .sch-people { gap: 8px; }
  .sch-person { min-height: 44px; }
  /* 一覧の行は 48px 以上、隣との間は 8px 以上 */
  .sch-sp-who, .sch-sp-name { min-height: 44px; }
  .sch-sp-ev { min-height: 48px; }
  .sch-wdate { min-height: 48px; justify-content: center; }
  .sch-widget-list .sch-ev { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; min-height: 48px; margin-bottom: 8px; padding: 6px 8px 6px 9px; }
  .sch-widget-list .sch-ev > * { margin-right: 0; }
}

@media print {
  .sch-views, .sch-toolbar, .sch-add, .sch-form-foot { display: none !important; }
  .sch-tg-scroll { max-height: none; overflow: visible; }
  /* 印刷は紙の幅にかかわらず表で出す */
  .sch-sp, .sch-layout-switch { display: none !important; }
  .sch-is-list .sch-gtable { display: block !important; }
}

/* ---- PHP 版で追加: フォームのラジオボタンを使った切り替え（JS なしでも選択状態が見える） ---- */
.sch-seg label.btn { position: relative; }
.sch-seg input[type="radio"], .sch-pill input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.sch-seg label.btn:has(input:checked) { background: var(--c-primary-weak); color: var(--c-primary); border-color: var(--c-primary); z-index: 1; }
/* ラジオボタン自体は見えないので、フォーカスの輪郭はラベルに出す */
.sch-seg label.btn:has(input:focus-visible), .sch-pill:has(input:focus-visible) { outline: 2px solid var(--c-focus); outline-offset: 2px; z-index: 2; }
.sch-pill { position: relative; }
.sch-pill:has(input:checked) { background: color-mix(in srgb, var(--mc) 16%, var(--c-surface)); border-color: var(--mc); font-weight: 700; box-shadow: 0 0 0 1px var(--mc); }
.sch-cell .sch-add:hover { text-decoration: none; }
