/* Bookday 見た目（柔らかい北欧風）。色は docs/改善プラン.md「1. 配色」 */
:root {
  --bg: #FAF8F5;
  --surface: #FFFFFF;
  --surface-2: #F2EFEA;
  --line: #E3DED7;
  --text: #33302C;
  --text-2: #6B655E;
  --text-disabled: #A39D95;
  --accent: #3E6B73;
  --accent-dark: #2E525A;
  --accent-soft: #E3EEEF;
  --ok: #2F6B45;
  --ok-bg: #E6F2E9;
  --warn: #8A5A10;
  --warn-bg: #FBF0DA;
  --danger: #A3392F;
  --danger-bg: #F9E5E2;
  --seminar-line: #8A8378;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(51, 48, 44, .06);
  --panel-w: 400px;
  --font: "Yu Gothic UI", "YuGothic", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", "Noto Sans JP", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.35; margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
.muted { color: var(--text-2); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== 上の帯 ===== */
.trial-banner {
  background: var(--warn-bg); color: var(--warn); text-align: center;
  font-size: 14px; padding: 6px 16px; border-bottom: 1px solid var(--line);
}
.alert {
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: center;
  padding: 10px 16px; font-size: 15px; border-bottom: 1px solid var(--line);
}
.alert.is-error { background: var(--danger-bg); color: var(--danger); }
.alert.is-warn { background: var(--warn-bg); color: var(--warn); }

/* ===== メニュー ===== */
.topbar {
  display: flex; align-items: center; gap: 24px; height: 52px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; font-size: 19px; color: var(--accent-dark); letter-spacing: .02em; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a {
  text-decoration: none; color: var(--text); padding: 8px 14px; border-radius: var(--radius); font-size: 16px;
}
.topnav a:hover { background: var(--accent-soft); }
.topnav a.is-active { background: var(--accent); color: #fff; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; padding: 8px 10px; border-radius: var(--radius); min-height: 44px; }
.link-btn:hover { background: var(--accent-soft); }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: none;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 56px; text-decoration: none; color: var(--text-2); font-size: 14px; line-height: 1.2;
}
.bottomnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav a.is-active { color: var(--accent); font-weight: 700; }

/* ===== 本文 ===== */
.main { padding: 12px 20px 32px; max-width: 1400px; margin: 0 auto; outline: none; transition: margin-right .15s; }
body.panel-push .main { margin-right: var(--panel-w); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stack > * + * { margin-top: 12px; }
.notice { border-radius: var(--radius); padding: 10px 14px; font-size: 15px; }
.notice.is-warn { background: var(--warn-bg); color: var(--warn); }
.notice.is-error { background: var(--danger-bg); color: var(--danger); }
.notice.is-ok { background: var(--ok-bg); color: var(--ok); }
.notice.is-info { background: var(--accent-soft); color: var(--text); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }

/* ===== ボタン ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 18px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:disabled, .btn[aria-disabled="true"] { color: var(--text-disabled); background: var(--surface-2); border-color: var(--line); cursor: not-allowed; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: 15px; }
.icon-btn { min-width: 44px; min-height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); cursor: pointer; font-size: 18px; line-height: 1; }
.icon-btn:hover { background: var(--accent-soft); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { border: none; background: none; min-height: 40px; min-width: 56px; padding: 4px 14px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.is-on { background: var(--accent); color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

/* ===== 入力 ===== */
.field { display: block; }
.field > .label { display: block; font-size: 15px; margin-bottom: 4px; }
.input {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid #CFC8BF; border-radius: var(--radius);
  background: var(--surface); font-size: 16px;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.input.is-invalid { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 14px; margin-top: 4px; }
.field-help { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.inline-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.inline-fields .input { width: 96px; text-align: right; }
.inline-fields .input.wide { width: 150px; }
.unit { white-space: nowrap; }
details.fold { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.fold > summary { cursor: pointer; padding: 10px 14px; min-height: 44px; list-style: none; background: var(--surface-2); border-radius: var(--radius); }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸ "; }
details.fold[open] > summary::before { content: "▾ "; }
details.fold[open] > summary { border-radius: var(--radius) var(--radius) 0 0; }
details.fold > .fold-body { padding: 12px 14px; }
.focus-ring:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== ログイン ===== */
.login-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center; padding: 24px 0; }
.login-card { width: 100%; max-width: 360px; }
.login-card .brand-big { font-size: 26px; font-weight: 700; color: var(--accent-dark); text-align: center; }
.login-card .sub { text-align: center; color: var(--text-2); font-size: 14px; margin-bottom: 16px; }
.pw-row { display: flex; gap: 8px; }
.pw-row .input { flex: 1; min-width: 0; }

/* ===== カレンダー ===== */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 8px; }
.cal-title { font-size: 20px; font-weight: 700; min-width: 7.5em; text-align: center; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.big-total { margin-left: auto; text-align: right; display: grid; grid-template-columns: auto auto; column-gap: 14px; align-items: center; }
.big-total .label { grid-column: 1; grid-row: 1; }
.big-total .breakdown { grid-column: 1; grid-row: 2; }
.big-total .value { grid-column: 2; grid-row: 1 / span 2; }
.big-total .label { font-size: 14px; color: var(--text-2); }
.big-total .value { font-size: 30px; font-weight: 700; line-height: 1.2; }
.big-total .breakdown { font-size: 14px; color: var(--text-2); }

.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) 132px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.month .dow { background: var(--surface-2); text-align: center; font-size: 14px; color: var(--text-2); padding: 4px 0; }
.month .dow.weekcol { font-size: 14px; white-space: nowrap; padding: 4px 2px; }
.cell {
  background: var(--surface); min-height: 86px; padding: 3px 4px 4px; cursor: pointer; font-size: 14px; line-height: 1.35;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; position: relative; text-align: left; border: none; width: 100%;
}
.cell.weekend { background: var(--surface-2); }
.cell:hover { background: var(--accent-soft); }
.cell.other-month .date { color: var(--text-disabled); }
.cell.is-today { box-shadow: inset 0 0 0 3px var(--accent); }
.cell.is-selected { background: var(--accent-soft); }
.cell .date-row { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; min-height: 18px; }
.cell .date { font-size: 14px; color: var(--text-2); font-weight: 600; }
.cell .today-tag { font-size: 14px; color: var(--accent); font-weight: 700; margin-left: 2px; }
.cell .day-amount { font-size: 14px; font-weight: 600; color: var(--text); }
.weektotal { background: var(--surface); display: flex; align-items: center; justify-content: flex-end; padding: 4px 8px; font-weight: 700; font-size: 15px; }

.band {
  display: flex; align-items: center; gap: 4px; height: 18px; padding: 0 5px; border-radius: 4px;
  font-size: 14px; line-height: 18px; white-space: nowrap; overflow: hidden; min-width: 0; border: none; cursor: pointer; width: 100%; text-align: left;
}
.band .nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.band .ct { flex: none; }
.band.support { height: 18px; line-height: 16px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-left: 6px solid var(--c, var(--line)); font-size: 14px; }
.band.seminar { background: var(--surface); color: var(--text); border: 1.5px dashed var(--seminar-line); }
.band.deposit { background: transparent; color: var(--text-2); border: 1px solid var(--line); height: 18px; line-height: 16px; }
.band.deposit .amt { flex: none; color: var(--text); }
.band.deposit .nm { color: var(--text-2); }
.band.more { background: transparent; color: var(--accent); text-decoration: underline; height: 18px; padding: 0 2px; }
.band.finished-dot { }

.week-sums { display: none; margin-top: 14px; }
.week-sums ul { list-style: none; margin: 0; padding: 0; }
.week-sums li { display: flex; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.week-sums li:first-child { border-top: 1px solid var(--line); }

/* 日の詳細（スマホの月表示の下・週表示・パネル） */
.day-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.day-block.is-today { border: 2px solid var(--accent); }
.day-block .day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.day-block .day-head .d { font-weight: 700; }
.day-block .day-head .amt { font-weight: 700; }
.ev-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ev-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 10px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left;
}
.ev-row:hover { background: var(--accent-soft); }
.ev-row .chip { flex: none; width: 14px; height: 28px; border-radius: 4px; }
.ev-row .chip.support { width: 6px; }
.ev-row .chip.seminar { background: var(--surface); border: 1.5px dashed var(--seminar-line); width: 14px; }
.ev-row .body { flex: 1; min-width: 0; }
.ev-row .t { display: block; overflow-wrap: anywhere; }
.ev-row .s { display: block; font-size: 14px; color: var(--text-2); }
.ev-row .a { flex: none; font-weight: 600; }
.ev-row.deposit { cursor: default; background: transparent; }
.add-line { margin-top: 8px; }
.week-list { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }

/* ===== パネル（右から・スマホは下から） ===== */
.panel-backdrop { position: fixed; inset: 0; background: rgba(51, 48, 44, .25); z-index: 30; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); max-width: 100%; z-index: 31;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: -4px 0 16px rgba(51, 48, 44, .08);
  display: flex; flex-direction: column;
}
.panel-head { display: flex; align-items: flex-start; gap: 8px; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { flex: 1; padding-top: 8px; overflow-wrap: anywhere; }
.panel-body { flex: 1; overflow-y: auto; padding: 14px 16px 20px; -webkit-overflow-scrolling: touch; }
.panel-foot { border-top: 1px solid var(--line); padding: 10px 16px; background: var(--surface); padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.panel-foot .confirm { font-size: 15px; margin-bottom: 8px; }
.section-title { font-size: 15px; font-weight: 700; color: var(--text-2); margin: 16px 0 6px; }
.section-title:first-child { margin-top: 0; }
.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 10px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer;
}
.pick:hover { background: var(--accent-soft); }
.pick.is-selected { background: var(--accent-soft); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pick .check { width: 18px; flex: none; color: var(--accent); font-weight: 700; }
.pick .chip { flex: none; width: 14px; height: 28px; border-radius: 4px; }
.pick .chip.support { width: 6px; }
.pick .chip.seminar { background: var(--surface); border: 1.5px dashed var(--seminar-line); }
.pick .body { flex: 1; min-width: 0; }
.pick .t { display: block; overflow-wrap: anywhere; }
.pick .s { display: block; font-size: 14px; color: var(--text-2); }
.pick:disabled { cursor: not-allowed; color: var(--text-disabled); background: var(--surface-2); }
.pick:disabled .s { color: var(--text-disabled); }
.blocked-list { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.blocked-list li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--line); }
.blocked-list li:last-child { border-bottom: none; }
.blocked-list .chip { flex: none; width: 10px; height: 20px; border-radius: 3px; margin-top: 3px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 15px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; text-align: right; }
.danger-zone { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }

/* 色を選ぶ */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.swatch {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 8px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; font-size: 14px; line-height: 1.3;
}
.swatch .chip { width: 22px; height: 22px; border-radius: 5px; flex: none; }
.swatch.is-selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.swatch .used { display: block; color: var(--text-2); font-size: 14px; }

/* ===== 生徒の一覧 ===== */
.st-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.st-table th, .st-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.st-table th { font-size: 14px; color: var(--text-2); font-weight: 600; background: var(--surface-2); }
.st-table tbody tr { cursor: pointer; }
.st-table tbody tr:hover { background: var(--accent-soft); }
.st-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.st-name .chip { width: 14px; height: 24px; border-radius: 4px; flex: none; }
.st-name .done-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.st-cards { display: none; flex-direction: column; gap: 8px; }
.st-card { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; }
.st-card .row2 { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 15px; color: var(--text-2); margin-top: 2px; }

/* ===== 収入のまとめ ===== */
.sum-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.sum-cards .value { font-size: 30px; font-weight: 700; line-height: 1.25; }
.sum-cards .diff { font-size: 15px; margin-top: 4px; }
.chart-wrap { overflow: hidden; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.chart-picked { min-height: 26px; font-weight: 600; margin-bottom: 4px; }
.sum-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); margin-top: 8px; }
.sum-table th, .sum-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: right; }
.sum-table th:first-child, .sum-table td:first-child { text-align: left; }
.sum-table th { font-size: 14px; color: var(--text-2); background: var(--surface-2); font-weight: 600; }
.sum-table tbody tr:nth-child(even) { background: #FCFBF9; }
.sum-table .wrapnum { white-space: nowrap; }
.bar-label-mobile { display: none; }

/* ===== 設定 ===== */
.settings { max-width: 720px; }
.preview-card .big { font-size: 32px; font-weight: 700; line-height: 1.2; }
.preview-card .unsaved { font-size: 15px; color: var(--warn); margin-left: 8px; font-weight: 400; }
.preview-card .how { font-size: 14px; color: var(--text-2); margin-top: 8px; }
.preview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; font-size: 15px; }
.preview-grid .v { font-weight: 700; display: block; }
.form-grid { display: flex; flex-direction: column; gap: 14px; }

/* ===== お知らせ・確認 ===== */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--text); color: #fff; border-radius: var(--radius); padding: 10px 14px; max-width: calc(100% - 32px); width: max-content;
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; box-shadow: 0 4px 16px rgba(0, 0, 0, .18); font-size: 15px;
}
.toast.is-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #BFD9C6; }
.toast.is-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #EBC3BD; }
.toast.is-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #EDD7A8; }
.toast .t-msg { white-space: pre-line; }
.toast .t-act { background: var(--surface); color: var(--accent); border: 1px solid var(--accent); border-radius: var(--radius); min-height: 40px; padding: 4px 12px; cursor: pointer; }
.modal-back { position: fixed; inset: 0; background: rgba(51, 48, 44, .35); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 18px; width: 100%; max-width: 440px; box-shadow: 0 8px 28px rgba(0, 0, 0, .2); }
.modal p { margin: 8px 0 16px; overflow-wrap: anywhere; }
.loading { position: fixed; top: 45%; left: 50%; transform: translate(-50%, -50%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 20px; z-index: 70; box-shadow: var(--shadow); }

/* ===== 幅ごとの調整 ===== */
@media (max-width: 1099px) {
  body.panel-push .main { margin-right: auto; }
}
@media (max-width: 900px) {
  .month { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .month .weekcol, .month .weektotal { display: none; }
  .week-sums { display: block; }
}
@media (max-width: 760px) {
  .topbar { height: 48px; padding: 0 16px; }
  .topnav, .logout-top { display: none !important; }
  .bottomnav { display: flex; }
  .main { padding: 12px 16px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 20px; }
  .cal-toolbar { gap: 8px; }
  .cal-title { font-size: 18px; min-width: 0; flex: 1; }
  .cal-nav { width: 100%; }
  .big-total { margin-left: 0; width: 100%; text-align: left; order: -1; display: block; }
  .big-total .value { font-size: 28px; }
  .month .dow { font-size: 14px; }
  .cell { min-height: 64px; padding: 2px 2px 3px; gap: 2px; }
  .cell .date-row { justify-content: center; min-height: 17px; }
  .cell .date { font-size: 14px; line-height: 1.2; }
  .cell .today-tag, .cell .day-amount { display: none; }
  .cell.is-today .date { color: #fff; background: var(--accent); border-radius: 9px; padding: 0 5px; }
  .band { height: 17px; line-height: 17px; padding: 0; justify-content: center; font-size: 14px; border-radius: 3px; }
  .band .nm, .band .ct, .band .full, .band .amt { display: none; }
  .band .ini { display: inline; }
  .band.support { height: 5px; border: none; padding: 0; border-radius: 3px; background: var(--c, var(--line)); }
  .band.seminar { height: 17px; }
  .band.deposit { height: 5px; border: none; background: var(--line); }
  .band.more { height: 16px; line-height: 16px; font-size: 14px; text-decoration: none; }
  .panel { top: auto; left: 0; width: 100%; height: 92vh; height: 92dvh; border-left: none; border-radius: 14px 14px 0 0; box-shadow: 0 -4px 16px rgba(51, 48, 44, .12); }
  .st-table { display: none; }
  .st-cards { display: flex; }
  .sum-cards .value { font-size: 26px; }
  .bar-label-desktop { display: none; }
  .bar-label-mobile { display: block; }
  .preview-grid { grid-template-columns: 1fr; gap: 2px; }
  .preview-card .big { font-size: 30px; }
  /* スマホのお知らせは画面の上（ロゴの帯の上）に細く出す。下の予定やメニューをふさがない。押すと消える */
  .toast, body.panel-open .toast {
    bottom: auto; top: calc(6px + env(safe-area-inset-top)); width: calc(100% - 24px); max-width: none;
    flex-wrap: nowrap; padding: 6px 8px 6px 12px; gap: 8px; font-size: 14px; line-height: 1.4;
  }
  .toast .t-msg { flex: 1; min-width: 0; cursor: pointer; }
  .toast .t-act { flex: none; min-height: 36px; padding: 2px 10px; }
  .sum-table .wrapnum { white-space: normal; overflow-wrap: anywhere; }
  .preview-grid > div { display: flex; justify-content: space-between; gap: 8px; }
  .preview-grid .v { display: inline; }
}
@media (min-width: 761px) {
  .band .ini { display: none; }
}
@media (max-width: 360px) {
  .main { padding-left: 16px; padding-right: 16px; }
  .sum-cards { grid-template-columns: 1fr; }
  .inline-fields .input { width: 84px; }
  .inline-fields .input.wide { width: 130px; }
  .seg button { min-width: 48px; padding: 4px 10px; }
  .sum-table th, .sum-table td { padding: 8px 6px; }
}

/* ===== 生徒の20色（app/calc.js の PALETTE と同じ順。tests/store.test.js で一致を確かめている） =====
   CSP で画面の中のスタイル（style 属性）を禁止しているため、色はこのクラスで付ける */
.pc0 { --c: #2F5D7C; background: #2F5D7C; color: #FFFFFF; }
.pc1 { --c: #D9B44A; background: #D9B44A; color: #33302C; }
.pc2 { --c: #3F6B4F; background: #3F6B4F; color: #FFFFFF; }
.pc3 { --c: #F0B8C8; background: #F0B8C8; color: #33302C; }
.pc4 { --c: #5B4B7A; background: #5B4B7A; color: #FFFFFF; }
.pc5 { --c: #9ED3CC; background: #9ED3CC; color: #33302C; }
.pc6 { --c: #A0552A; background: #A0552A; color: #FFFFFF; }
.pc7 { --c: #A9C7DD; background: #A9C7DD; color: #33302C; }
.pc8 { --c: #9B3D45; background: #9B3D45; color: #FFFFFF; }
.pc9 { --c: #B5D3B0; background: #B5D3B0; color: #33302C; }
.pc10 { --c: #2B3A55; background: #2B3A55; color: #FFFFFF; }
.pc11 { --c: #E9C8A0; background: #E9C8A0; color: #33302C; }
.pc12 { --c: #2E7A78; background: #2E7A78; color: #FFFFFF; }
.pc13 { --c: #C6B8DE; background: #C6B8DE; color: #33302C; }
.pc14 { --c: #7A5C2E; background: #7A5C2E; color: #FFFFFF; }
.pc15 { --c: #F1E3A0; background: #F1E3A0; color: #33302C; }
.pc16 { --c: #66702E; background: #66702E; color: #FFFFFF; }
.pc17 { --c: #E59A7F; background: #E59A7F; color: #33302C; }
.pc18 { --c: #5E6E7B; background: #5E6E7B; color: #FFFFFF; }
.pc19 { --c: #7A3B62; background: #7A3B62; color: #FFFFFF; }

/* ===== 小さな部品（以前は style 属性で書いていたもの） ===== */
.mt0 { margin-top: 0 !important; }
.mt8 { margin-top: 8px; }
.mt10 { margin-top: 10px; }
.mt12 { margin-top: 12px; }
.mt18 { margin-top: 18px; }
.mb6 { margin-bottom: 6px; }
.mb10 { margin-bottom: 10px; }
.mb12 { margin-bottom: 12px; }
.w100 { width: 100%; }
.maxw200 { max-width: 200px; }
.inline-fields .input.w170, .w170 { width: 170px; }
.fw400 { font-weight: 400; }
.warn-text { color: var(--warn); margin-top: 6px; }
.list-head { margin: 6px 0 8px; }
.band.static { width: auto; display: inline-flex; cursor: default; }
.band.preview { max-width: 180px; }
.color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; }
.preview-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.chart-wrap .bar { cursor: pointer; }
.ini .ini1, .ini .ini2 { display: none; }
.plain-list { list-style: none; margin: 4px 0 0; padding: 0; }
.plain-list li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.plain-list .chip { width: 10px; height: 20px; border-radius: 3px; flex: none; }
.modal-warn { margin: -6px 0 16px; }

/* ===== 2段階認証 ===== */
.mfa-card { max-width: 420px; }
.mfa-steps { margin: 0; padding-left: 1.4em; font-size: 15px; }
.mfa-steps li + li { margin-top: 4px; }
.mfa-qr { display: flex; justify-content: center; }
.mfa-qr img { width: 200px; height: 200px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; }
.mfa-secret { font-family: Consolas, "Courier New", monospace; font-size: 17px; letter-spacing: .04em; background: var(--surface-2); padding: 8px 10px; border-radius: var(--radius); user-select: all; overflow-wrap: anywhere; white-space: normal; }
.otp-input { font-size: 24px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }

/* ===== カレンダー：まとめて入れる（選ぶモード） ===== */
.cal-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bulk-band { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; }
.bulk-band-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-weight: 700; }
.bulk-who { flex: 1 1 12em; min-width: 0; overflow-wrap: anywhere; }
.bulk-who .chip { display: inline-block; width: 12px; height: 18px; border-radius: 3px; vertical-align: -3px; margin: 0 4px 0 2px; }
.bulk-note { font-size: 15px; margin-top: 2px; }
.month.is-bulk .cell:hover { background: var(--accent-soft); }
.cell.is-bulk-selected { box-shadow: inset 0 0 0 3px var(--accent); background: var(--accent-soft); }
.cell.is-bulk-blocked:not(.is-bulk-selected) { background: var(--warn-bg); }
.bulk-mark { display: flex; flex-wrap: wrap; gap: 0 6px; font-size: 14px; font-weight: 700; line-height: 1.3; }
.bulk-mark .sel { color: var(--accent-dark); }
.bulk-mark .ng { color: var(--warn); }
.bulk-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; align-items: center; justify-content: flex-end; gap: 8px 16px; flex-wrap: wrap;
  background: var(--surface); border-top: 2px solid var(--accent); padding: 10px 20px; padding-bottom: calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(51, 48, 44, .10);
}
.bulk-bar .bb-text { flex: 1 1 auto; min-width: 0; font-size: 15px; }
.bulk-bar .bb-ng { color: var(--warn); font-weight: 700; }
body.bulk-mode .topnav, body.bulk-mode .logout-top { visibility: hidden; }
body.bulk-mode .bottomnav { display: none !important; }
body.bulk-mode .main { padding-bottom: 96px; }
.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-list li { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.plan-list li:last-child { border-bottom: none; }
.plan-list .ok-mark { color: var(--ok); font-weight: 700; }
.plan-list .ng-mark { color: var(--danger); font-weight: 700; }
.plan-list .pd { white-space: nowrap; }
.plan-list .why { flex-basis: 100%; padding-left: 1.4em; font-size: 14px; color: var(--text-2); }

/* ===== 入れるパネル・予定の詳細：無料セミナーの記録 ===== */
.sem-fields { margin-top: 10px; padding: 10px 12px; border: 1px dashed var(--seminar-line); border-radius: var(--radius); }

/* ===== 生徒の詳細：契約の設定を直す ===== */
.contract-edit { border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px; background: var(--surface); }
.contract-edit h3 { margin-bottom: 10px; }
.contract-edit .notice { margin-bottom: 10px; }
.ce-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.ce-table th, .ce-table td { padding: 4px 4px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: top; }
.ce-table th:first-child { text-align: left; font-weight: 400; color: var(--text-2); }
.ce-table thead th { font-size: 14px; color: var(--text-2); font-weight: 600; }
.ce-table .arrow { color: var(--text-2); width: 1.2em; text-align: center; }
.ce-table tr.is-changed td:last-child { font-weight: 700; }
.ce-table .chg { display: block; font-size: 14px; font-weight: 400; color: var(--warn); }

/* ===== 収入のまとめ ===== */
.sum-top { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 4fr); gap: 12px; margin-bottom: 12px; align-items: start; }
.main-card { border-top: 3px solid var(--accent); }
.mc-title { font-size: 15px; color: var(--text-2); }
.mc-value { font-size: 32px; font-weight: 700; line-height: 1.25; }
.split-bar { display: block; width: 100%; height: 8px; margin: 6px 0; border-radius: 2px; }
.mc-line { font-size: 15px; }
.lg-solid, .lg-hatch { color: var(--accent); }
.main-card .diff { font-size: 15px; margin-top: 6px; }
.unearned-card { background: var(--surface-2); box-shadow: none; }
.uc-title { font-size: 16px; font-weight: 700; }
.uc-sub { font-size: 14px; color: var(--text-2); }
.uc-value { font-size: 24px; font-weight: 700; line-height: 1.3; margin-top: 2px; }
.uc-lead { margin: 6px 0 0; }
details.fold-plain { margin-top: 8px; }
details.fold-plain > summary { cursor: pointer; color: var(--accent); min-height: 32px; display: flex; align-items: center; list-style: none; }
details.fold-plain > summary::-webkit-details-marker { display: none; }
details.fold-plain > summary::before { content: "▸"; margin-right: .3em; }
details.fold-plain[open] > summary::before { content: "▾"; }
.help-list { margin: 4px 0 0; padding-left: 1.2em; }
.help-list li + li { margin-top: 4px; }
.un-table { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--surface); margin-top: 4px; }
.un-table th, .un-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
.un-table th:first-child, .un-table td:first-child { text-align: left; }
.un-table thead th { font-size: 14px; color: var(--text-2); font-weight: 600; }
.un-table tfoot th, .un-table tfoot td { font-weight: 700; }
.un-table .st-name { align-items: flex-start; }
.un-table .chip, .un-card .chip { width: 10px; height: 20px; border-radius: 3px; flex: none; margin-top: 2px; }
.fin-note { display: block; }
.un-cards { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.un-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.un-card .st-name { justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; }
.un-card .un-name { display: flex; align-items: flex-start; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.tiles.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; background: var(--surface); min-width: 0; }
.tile .t-label { font-size: 14px; color: var(--text-2); }
.tile .t-value { font-size: 18px; font-weight: 700; }
.tile .t-note { font-size: 14px; color: var(--text-2); }
.legend { margin: 4px 0 6px; color: var(--text-2); }
.nav-end { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; text-align: right; }
.sum-table tr.is-current { background: var(--accent-soft) !important; }
.sum-cards-sp { display: flex; flex-direction: column; gap: 6px; }
.sum-card-sp { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.sum-card-sp .row1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; flex-wrap: wrap; }
.sum-card-sp .row1 .num { white-space: normal; overflow-wrap: anywhere; }
.export { margin-top: 22px; }
.export-btns { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.ex-item { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===== 追加分の幅ごとの調整 ===== */
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles.is-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .sum-top { grid-template-columns: 1fr; }
  .mc-value { font-size: 28px; }
  .uc-value { font-size: 22px; }
  .tile { padding: 8px 10px; }
  .tile .t-value { font-size: 18px; white-space: normal; overflow-wrap: anywhere; }
  .cal-tools { width: 100%; justify-content: space-between; }
  .band .ini { display: inline; }
  .band.preview .nm, .band.preview .ct { display: inline; }
  .band.preview .ini { display: none; }
  .band.preview { justify-content: flex-start; padding: 0 5px; }
  .bulk-mark .bulk-txt { display: none; }
  .bulk-mark { justify-content: center; font-size: 14px; }
  .bulk-bar { padding: 8px 16px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .export-btns { flex-direction: column; }
  .export-btns .ex-item, .export-btns .btn { width: 100%; }
}
/* マスの名前：ふつうは苗字3文字。360px 未満の幅では2文字、320px 未満では1文字（文字は14pxのまま） */
@media (max-width: 359px) {
  .ini .ini3 { display: none; }
  .ini .ini2 { display: inline; }
}
@media (max-width: 319px) {
  .ini .ini2 { display: none; }
  .ini .ini1 { display: inline; }
}
/* まとめて入れる（選ぶモード）のあいだ、パソコンのお知らせは下の帯の上に出す（帯の文字を隠さない。講師役の指摘） */
@media (min-width: 761px) {
  body.bulk-mode .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}
/* 書き出す期間（追加機能10） */
.ex-range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; margin: 4px 0 12px; }
.ex-range > .label { flex-basis: 100%; font-size: 15px; }
.ex-dates { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 8px; }
.ex-dates .field { min-width: 0; }
.ex-tilde { padding-bottom: 10px; }
.ex-pick .input { max-width: 200px; }
.sum-card-sp.is-current { border-color: var(--accent); }
@media (max-width: 760px) {
  .ex-range .seg { width: 100%; }
  .ex-range .seg button { flex: 1; min-width: 0; padding: 4px 6px; }
  .ex-dates { width: 100%; }
  .ex-dates .field { flex: 1 1 130px; }
  .ex-dates .input { width: 100%; max-width: none; }
  .ex-tilde { display: none; }
}
