/* 共通の見た目（やわらかい色づかい） */
:root {
  color-scheme: light;
  --bg: #FFF8F0;
  --card: #FFFFFF;
  --ink: #3B3A48;
  --sub: #7A7686;
  --line: #F0E5D8;
  --primary: #EE8358;
  --primary-dark: #D96C41;
  --primary-soft: #FDE9DF;
  --mint: #3FA588;
  --mint-soft: #DDF3EC;
  --sky: #4F8FD0;
  --sky-soft: #E3EFFB;
  --warn: #B7801E;
  --warn-soft: #FBF0D9;
  --danger: #D2574F;
  --danger-soft: #FBE3E1;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(120, 90, 60, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: 16px; line-height: 1.6;
}
h1, h2, h3 { line-height: 1.35; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--sky); }

/* 見出し：英語＋日本語 */
.en-ja { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.en-ja .en { font-weight: 700; letter-spacing: .02em; }
.en-ja .ja { font-size: .82em; color: var(--sub); font-weight: 500; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 700; font-size: .95rem; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: #e2d3c1; background: #fffdfa; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.mint { background: var(--mint); border-color: var(--mint); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 4px 14px; font-size: .88rem; }
a.btn { text-decoration: none; }
.btn.link { border: none; background: none; color: var(--sub); text-decoration: underline; padding: 4px 6px; min-height: 36px; font-weight: 500; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--bg); font-size: 1.4rem; cursor: pointer; flex: none; }

/* バッジ */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge.absent { background: var(--danger-soft); color: var(--danger); }
.badge.makeup { background: var(--mint-soft); color: var(--mint); }
.badge.online { background: var(--sky-soft); color: var(--sky); }
.badge.offline { background: var(--primary-soft); color: var(--primary-dark); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.gray { background: #F1EEEA; color: var(--sub); }
.badge.new { background: var(--primary); color: #fff; }

/* 入力欄 */
label.field { display: block; margin: 0 0 12px; }
label.field > span { display: block; font-size: .85rem; color: var(--sub); margin-bottom: 4px; font-weight: 700; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=url], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid var(--primary-soft); border-color: var(--primary); }
.check { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }

/* 下から出るウィンドウ */
.sheet-wrap {
  position: fixed; inset: 0; background: rgba(59, 58, 72, .38); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s;
}
.sheet {
  background: #fff; width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column;
  border-radius: 22px 22px 0 0; animation: up .2s ease-out;
}
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 22px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 18px 6px; }
.sheet-head h3 { font-size: 1.1rem; }
.sheet-head .sub { margin: 2px 0 0; color: var(--sub); font-size: .85rem; }
.sheet-body { padding: 8px 18px 12px; overflow-y: auto; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); flex-wrap: wrap; }
.sheet-actions .btn { flex: 1 1 140px; }
.err { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 12px; font-size: .9rem; margin: 8px 0 0; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* 小さなお知らせ */
.toast {
  position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top)); transform: translate(-50%, -20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: .92rem;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 80; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

.demo-bar { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: .85rem; padding: 6px 12px; font-weight: 700; }
.muted { color: var(--sub); }
.small { font-size: .85rem; }
.empty { color: var(--sub); text-align: center; padding: 18px 8px; font-size: .92rem; }
.loading { text-align: center; color: var(--sub); padding: 60px 16px; }
[hidden] { display: none !important; }

/* 受付時間の表（マスを押して選ぶ） */
.av-tabs { display: flex; gap: 8px; margin: 4px 0 10px; }
.av-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
.av-nav b { font-size: .95rem; text-align: center; }
.av-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; }
.av-grid { width: 100%; min-width: 330px; border-collapse: separate; border-spacing: 3px; table-layout: fixed; }
.av-grid thead th { font-size: .78rem; font-weight: 700; color: var(--ink); vertical-align: top; padding: 4px 0; line-height: 1.3; }
.av-grid thead th.today { color: var(--primary-dark); }
.av-grid thead th:first-child, .av-grid tbody th { width: 44px; }
.av-grid tbody th { font-size: .72rem; font-weight: 600; color: var(--sub); text-align: right; padding-right: 4px; }
.av-grid td { padding: 0; }
.av-cell { display: block; width: 100%; height: 30px; line-height: 30px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--sub);
  font: inherit; font-size: .7rem; text-align: center; padding: 0 2px; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
button.av-cell:hover { border-color: var(--primary); }
.av-cell.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.av-cell.busy { background: #E6E3EA; border-color: #E6E3EA; color: var(--ink); cursor: default; }
.av-cell.off { background: #F6F3EF; border-color: #F6F3EF; cursor: default; }
.av-cell.off.was { color: #B8B2AA; }
.av-tag { display: inline-block; margin-top: 2px; font-size: .62rem; font-weight: 700; padding: 1px 4px; border-radius: 6px; background: #F0ECE6; color: var(--sub); }
.av-tag.own { background: var(--sky-soft); color: var(--sky); }
.av-tag.pend { background: var(--warn-soft); color: var(--warn); }
.av-reset { display: block; margin: 3px auto 0; font: inherit; font-size: .6rem; color: var(--sky); background: none; border: 0; text-decoration: underline; cursor: pointer; padding: 0; }
.av-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0; font-size: .78rem; color: var(--sub); }
.av-legend span { display: flex; align-items: center; gap: 5px; }
.av-legend i.av-cell { width: 16px; height: 16px; line-height: 16px; display: inline-block; }
.av-save { position: sticky; bottom: 10px; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px;
  background: var(--warn-soft); border: 1px solid #EBD3A3; border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); }
.av-save span { flex: 1 1 140px; font-weight: 700; color: var(--warn); font-size: .9rem; }

/* イベント */
.badge.event { background: #EFE7FA; color: #7A4FB5; }
/* 月のカレンダー（先生・保護者 共通） */
.mcal { padding: 12px; margin-bottom: 12px; }
.mcal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mcal-head b { font-size: 1rem; }
.mcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.mcal-wd { text-align: center; font-size: .72rem; font-weight: 700; color: var(--sub); padding: 2px 0; }
.mcal-wd.sun { color: var(--danger); } .mcal-wd.sat { color: var(--sky); }
.mcal-day { position: relative; min-height: 46px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; color: var(--ink);
  padding: 3px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.mcal-day .n { font-size: .8rem; font-weight: 700; line-height: 1.2; }
.mcal-day .c { position: absolute; top: 2px; right: 4px; font-size: .6rem; color: var(--sub); }
.mcal-day .dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.mcal-day.out { opacity: .4; }
.mcal-day.today { border-color: var(--primary); }
.mcal-day.sel { background: var(--primary-soft); border-color: var(--primary); }
.mcal-day.closed .n { color: var(--sub); text-decoration: line-through; }
.mcal i, .mcal-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-offline, .dot-lesson { background: var(--primary); }
.dot-online { background: var(--sky); }
.dot-makeup { background: var(--mint); }
.dot-extra { background: #2d6aa8; }
.dot-appt { background: var(--warn); }
.dot-event { background: #7A4FB5; }
.dot-closed { background: #C9C2B8; }
.mcal-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: .72rem; color: var(--sub); }
.mcal-legend span { display: inline-flex; align-items: center; gap: 4px; }
