/*
 * KDS LESSON BOARD の見た目（2026-10-12 作り直し）。
 * - 色はほかの社内アプリ（釧路食堂・ステイなど）と同じ紺とオレンジ。暗い画面の設定にも合わせる
 * - 指導員が iPad で使う前提：押す所は大きく（最低 44px）、文字は大きめ、ひと目で「次の教習」が分かる
 * - ログイン画面は kds-shokudo と同じ形（左＝キャッチコピー・右＝ログイン。iPad 縦とスマホは上に帯）
 */
:root {
  --bg: #f4f6f7; --panel: #ffffff; --panel-soft: #f8fafb; --border: #dfe5e9; --border-strong: #c9d3da;
  --text: #17212a; --text-dim: #66757f; --navy: #132330;
  --accent: #e96d2f; --accent-soft: #fff1e9; --accent-strong: #c65219;
  --good: #1f8a5f; --good-soft: #e6f5ee; --warn: #9a6a00; --warn-soft: #fff6dd; --bad: #b42318; --bad-soft: #fde8e8;
  --chip: #eef2f5; --now: #fff4ec; --shadow: 0 2px 12px rgba(16, 33, 45, .06); --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  color: var(--text); background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101820; --panel: #18232c; --panel-soft: #1d2a34; --border: #2b3a45; --border-strong: #3a4c58;
    --text: #edf2f4; --text-dim: #9baab4; --navy: #0c161e;
    --accent: #f1844d; --accent-soft: #3a261d; --accent-strong: #ff9a66;
    --good: #65c79a; --good-soft: #17322a; --warn: #f0c060; --warn-soft: #3a3118; --bad: #ff8a80; --bad-soft: #4a1f1f;
    --chip: #22313c; --now: #33251c; --shadow: 0 2px 12px rgba(0, 0, 0, .25);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; border: 1px solid transparent; border-radius: 10px; min-height: 44px; padding: 10px 16px;
  font-size: 15px; font-weight: 600; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .55; cursor: wait; }
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-strong); }
.secondary { background: var(--panel); color: var(--text); border-color: var(--border-strong); }
.secondary:hover { border-color: var(--accent); color: var(--accent-strong); }
.ghost { background: transparent; color: inherit; border-color: currentColor; }
@media (hover: none) { .primary:hover { background: var(--accent); } .secondary:hover { border-color: var(--border-strong); color: var(--text); } }
input, select { font-size: 16px; min-height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--panel); color: var(--text); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.message { margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--text); line-height: 1.6; font-size: 14.5px; }
.message.error { background: var(--bad-soft); color: var(--bad); }
.note { color: var(--text-dim); line-height: 1.7; }
.small { font-size: 13px; }

/* ---------------------------------------------------------------- ログイン（kds-shokudo と同じ形） */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.08fr .92fr; background: var(--panel); }
.login-visual { position: relative; min-height: 100vh; padding: clamp(54px, 9vw, 150px); display: flex; align-items: center;
  overflow: hidden; color: #fff; background: var(--navy); }
.login-copy { position: relative; z-index: 2; }
.login-eyebrow { margin: 0; color: #f79561; font-size: 12px; font-weight: 700; letter-spacing: .16em; }
.login-copy h1 { margin: 22px 0 24px; color: #fff; font-size: clamp(38px, 4.2vw, 66px); line-height: 1.27; letter-spacing: -.055em; }
.login-copy > p:not(.login-eyebrow) { margin: 0; color: #aebdc6; font-size: 15px; line-height: 2; }
.login-pills { margin-top: 48px; display: flex; flex-wrap: wrap; gap: 9px; }
.login-pills span { padding: 8px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 20px; color: #c7d1d7; background: rgba(255,255,255,.04); font-size: 13px; }
.login-panel { min-width: 0; padding: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--panel); }
.login { width: min(420px, 100%); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 54px; }
.login-brand .brand-mark { width: 40px; height: 40px; border-radius: 10px; }
.login-brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.login-brand-copy strong { font-size: 17px; }
.login-brand-copy small { margin-top: 6px; color: var(--text-dim); font-size: 11px; letter-spacing: .18em; }
.login-secure { margin: 0 0 10px; color: var(--good); font-size: 13px; font-weight: 700; }
.login h1 { font-size: 28px; line-height: 1.45; margin: 0 0 7px; }
.login .sub { color: var(--text-dim); font-size: 15px; line-height: 1.7; margin-bottom: 22px; }
.login form { margin: 0; }
.login label { display: block; margin: 18px 0 8px; font-size: 14px; font-weight: 700; }
.login input { width: 100%; min-height: 50px; padding: 0 14px; font-size: 16px; }
.login button.go { width: 100%; min-height: 52px; margin-top: 22px; padding: 0 18px; display: flex; align-items: center;
  justify-content: space-between; font-size: 16px; }
.login button.go::after { content: "\2192"; font-size: 19px; font-weight: 400; }
.login button.login-alt { width: 100%; margin-top: 12px; background: transparent; color: var(--text-dim); }
.login button.login-alt:hover { color: var(--accent-strong); background: var(--accent-soft); }
#passkey-login { color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }

/* キャッチコピーの決めの言葉の下線と、開いたときの全画面（kds-shokudo と同じ動き） */
.lv-line { display: block; overflow: hidden; padding-bottom: .14em; margin-bottom: -.14em; }
.lv-line > span { display: inline-block; }
.lv-accent { position: relative; }
.lv-accent::after { content: ""; position: absolute; left: .02em; right: .5em; bottom: .02em; height: .08em; border-radius: 2px; background: #f79561; }
.login-visual.lv-splash { position: fixed; inset: 0; z-index: 1000; display: flex !important; justify-content: center;
  min-height: 100dvh; padding: 32px clamp(28px, 9vw, 150px); cursor: pointer; animation: lv-leave .5s ease 3.1s forwards; }
.login-visual.lv-splash.lv-leave-now { animation: lv-leave-now .35s ease forwards; }
.lv-splash .login-copy { width: min(760px, 100%); }
.lv-splash .login-copy h1 { margin: 22px 0 24px; font-size: clamp(32px, 9vw, 72px); line-height: 1.27; letter-spacing: -.055em; }
.lv-splash .login-eyebrow { font-size: 12px; }
.lv-splash .login-copy .lv-line { display: block; }
.lv-splash .login-copy > p:not(.login-eyebrow) { display: block; font-size: 15px; line-height: 2; }
.lv-splash .login-pills { display: flex; margin-top: 40px; }
.lv-splash .lv-line > span { transform: translateY(110%); animation: lv-rise .95s cubic-bezier(.2, .8, .2, 1) .25s forwards; }
.lv-splash .lv-line > span.lv-accent {
  background: linear-gradient(100deg, #fff 38%, #fbc4a6 46%, #f79561 50%, #fbc4a6 54%, #fff 62%) 100% 0 / 260% 100% no-repeat;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: lv-rise .95s cubic-bezier(.2, .8, .2, 1) .43s forwards, lv-shine 1.3s ease-in-out 1.75s forwards; }
.lv-splash .lv-accent::after { transform: scaleX(0); transform-origin: left center; animation: lv-draw .75s cubic-bezier(.65, 0, .25, 1) 1.2s forwards; }
.lv-splash .login-eyebrow { animation: lv-fade .7s ease .05s both; }
.lv-splash .login-copy > p:not(.login-eyebrow) { animation: lv-fade .8s ease 1.0s both; }
.lv-splash .login-pills span { animation: lv-fade .6s ease both; }
.lv-splash .login-pills span:nth-child(1) { animation-delay: 1.25s; }
.lv-splash .login-pills span:nth-child(2) { animation-delay: 1.35s; }
.lv-splash .login-pills span:nth-child(3) { animation-delay: 1.45s; }
.lv-splash .login-pills span:nth-child(4) { animation-delay: 1.55s; }
@keyframes lv-rise { to { transform: translateY(0); } }
@keyframes lv-draw { to { transform: scaleX(1); } }
@keyframes lv-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes lv-fade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes lv-leave { to { opacity: 0; visibility: hidden; } }
@keyframes lv-leave-now { to { opacity: 0; visibility: hidden; } }

@media (max-width: 900px) {
  .login-wrap { display: block; }
  .login-visual { min-height: auto; padding: 36px 24px 30px; }
  .login-copy h1 { margin: 12px 0 10px; font-size: 30px; }
  .login-copy > p:not(.login-eyebrow) { font-size: 13.5px; line-height: 1.9; }
  .login-pills { margin-top: 16px; }
  .login-panel { min-height: auto; padding: 32px 20px 40px; justify-content: flex-start; }
  .login-brand { margin-bottom: 32px; }
}
@media (max-width: 600px) {
  .login-visual { padding: 18px 20px 16px; }
  .login-eyebrow { font-size: 11px; }
  .login-copy h1 { margin: 6px 0 0; font-size: 20px; line-height: 1.4; letter-spacing: -.03em; }
  .login-copy .lv-line { display: inline-block; vertical-align: top; }
  .login-copy > p:not(.login-eyebrow), .login-pills { display: none; }
  .login-panel { padding-top: 22px; }
  .login-brand { margin-bottom: 26px; }
  .login h1 { font-size: 24px; }
}

/* ---------------------------------------------------------------- 上の帯 */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .03em; font-size: 15px; }
.brand .logo { width: 32px; height: 32px; border-radius: 8px; }
.tabs { display: flex; gap: 4px; padding: 4px; margin: 0 auto; background: rgba(255,255,255,.08); border-radius: 12px; }
.tab { min-height: 40px; padding: 8px 18px; background: transparent; color: #c7d1d7; font-size: 15px; }
.tab[aria-pressed="true"] { background: #fff; color: var(--navy); }
.who { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #dbe3e8; white-space: nowrap; }
@media (max-width: 1000px) { .brand span { display: none; } }
.who .ghost { min-height: 36px; padding: 6px 12px; font-size: 13px; color: #dbe3e8; border-color: rgba(255,255,255,.35); }
@media (max-width: 760px) {
  .bar { flex-wrap: wrap; row-gap: 8px; }
  .brand span { display: none; }
  .tabs { order: 3; flex: 1 1 100%; margin: 0; }
  .tab { flex: 1; }
  .who { margin-left: auto; }
}

main { max-width: 1180px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); }

/* ---------------------------------------------------------------- 道具の列（職員・日付・最新） */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.staff-pick { flex: 1 1 280px; min-width: 0; display: flex; align-items: center; gap: 8px; }
.staff-pick select { flex: 1; min-width: 0; font-weight: 600; }
.segmented { display: inline-flex; padding: 3px; gap: 3px; border-radius: 12px; background: var(--chip); }
.segmented button { min-height: 40px; padding: 6px 16px; background: transparent; color: var(--text-dim); font-size: 15px; }
.segmented button[aria-pressed="true"] { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.segmented button small { display: block; font-size: 11px; font-weight: 500; color: var(--text-dim); }
.freshness { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 13px; }
.freshness .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; margin-right: 6px; }
.freshness .dot.busy { background: var(--accent); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .3; } }
.icon-btn { min-height: 40px; padding: 6px 14px; }

/* ---------------------------------------------------------------- 一人の予定 */
.next { position: relative; margin: 4px 0 18px; padding: 18px 20px; border-radius: var(--radius); background: var(--navy); color: #fff;
  box-shadow: var(--shadow); overflow: hidden; }
.next::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(233,109,47,.45), rgba(233,109,47,0) 70%); }
.next-label { margin: 0; color: #f79561; font-size: 12px; font-weight: 700; letter-spacing: .14em; }
.next-main { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-top: 8px; }
.next-period { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.next-time { font-size: 20px; font-weight: 600; color: #dbe3e8; }
.next-work { font-size: 16px; color: #aebdc6; }
.next-students { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.next-students .student { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.12); font-size: 16px; padding: 8px 14px; }
.next-students .student .no { color: #c7d1d7; }
.next-students .student .state { background: rgba(255,255,255,.14); color: #fff; }
.next.done { background: var(--panel); color: var(--text); border: 1px dashed var(--border-strong); }
.next.done::after { display: none; }
.next.done .next-label { color: var(--text-dim); }
.next-go { margin-top: 12px; }

.timeline { display: grid; gap: 8px; }
.slot { display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: start; padding: 14px 16px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); }
.slot.now { border-color: var(--accent); background: var(--now); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.slot.past { opacity: .55; }
.slot.no-work { border-style: dashed; }
.period { font-weight: 800; font-size: 20px; line-height: 1.15; }
.period small { display: block; margin-top: 4px; font-size: 13px; font-weight: 500; color: var(--text-dim); white-space: nowrap; }
.badge-now { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.work { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.work .muted { color: var(--text-dim); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.student { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-soft); font-size: 15px; }
.student b { font-weight: 700; }
.student .no { color: var(--text-dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.student .state { font-size: 12px; padding: 1px 6px; border-radius: 5px; background: var(--chip); color: var(--text-dim); }
.student .state.cancel { background: var(--bad-soft); color: var(--bad); }
.chip-muted { color: var(--text-dim); font-size: 14px; }
.empty { padding: 36px 20px; text-align: center; color: var(--text-dim); background: var(--panel); border: 1px dashed var(--border-strong); border-radius: var(--radius); line-height: 1.8; }
.footnote { margin-top: 18px; color: var(--text-dim); font-size: 12.5px; line-height: 1.8; }

/* ---------------------------------------------------------------- 全員の予定（職員 × 時限の表） */
.grid-scroll { overflow: auto; max-height: calc(100dvh - 190px); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
.all-grid { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13.5px; }
.all-grid th, .all-grid td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); vertical-align: top; }
.all-grid thead th { position: sticky; top: 0; z-index: 2; background: var(--panel-soft); padding: 8px 10px; text-align: center; white-space: nowrap; }
.all-grid thead th small { display: block; color: var(--text-dim); font-weight: 500; font-size: 11.5px; }
.all-grid thead th.now { background: var(--accent); color: #fff; }
.all-grid thead th.now small { color: #fff; }
.all-grid .who-col { position: sticky; left: 0; z-index: 1; min-width: 132px; max-width: 170px; padding: 0; background: var(--panel); text-align: left; }
.all-grid thead .who-col { z-index: 3; background: var(--panel-soft); padding: 8px 12px; }
.all-grid .who-col button { width: 100%; min-height: 56px; padding: 8px 12px; border-radius: 0; background: transparent; color: var(--text);
  text-align: left; font-weight: 700; font-size: 14px; white-space: normal; line-height: 1.35; }
.all-grid .who-col button small { display: block; color: var(--text-dim); font-weight: 500; font-size: 12px; }
.all-grid .who-col button:hover { background: var(--accent-soft); }
.all-grid tr.me .who-col, .all-grid tr.me .who-col button { background: var(--accent-soft); }
.all-grid td.cell { min-width: 118px; max-width: 170px; padding: 6px 8px; }
.all-grid td.cell.now { background: var(--now); }
.all-grid td.cell.past { opacity: .6; }
.cell-work { font-weight: 700; font-size: 12.5px; color: var(--text); }
.cell-work.off { color: var(--text-dim); font-weight: 500; }
.cell-st { margin-top: 4px; padding: 3px 6px; border-radius: 6px; background: var(--chip); font-size: 12.5px; line-height: 1.35; }
.cell-st .no { display: block; color: var(--text-dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.cell-st.cancel { background: var(--bad-soft); color: var(--bad); }
.cell-empty { color: var(--border-strong); text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: var(--text-dim); font-size: 12.5px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------------------------------------------------------------- 管理 */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h2 { font-size: 18px; margin: 0 0 6px; }
.card h3 { font-size: 15px; margin: 22px 0 6px; }
form.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 10px 0; }
.table-scroll { overflow-x: auto; }
.card table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.card th, .card td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.card th { color: var(--text-dim); font-size: 12.5px; font-weight: 700; }
.card td input { min-height: 40px; width: 8em; font-size: 15px; }
.card td button { min-height: 40px; padding: 6px 14px; font-size: 14px; }
.tag-warn { color: var(--warn); font-size: 12px; }
#bulk-text { width: 100%; margin-top: 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--panel); color: var(--text); font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.bulk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0; }
.bulk-st { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.bulk-st.new { background: var(--good-soft); color: var(--good); }
.bulk-st.change { background: var(--accent-soft); color: var(--accent-strong); }
.bulk-st.same { background: var(--chip); color: var(--text-dim); }
.bulk-st.bad { background: var(--bad-soft); color: var(--bad); }
.card td.wrap { white-space: normal; min-width: 180px; font-size: 12.5px; color: var(--text-dim); }

@media (max-width: 600px) {
  .slot { grid-template-columns: 84px 1fr; gap: 10px; padding: 12px; }
  .period small { font-size: 11.5px; }
  .period { font-size: 17px; }
  .next-period { font-size: 24px; }
  .next-time { font-size: 17px; }
  .freshness { margin-left: 0; width: 100%; }
}
