/* ============================================================
   先生ラクラク学校アプリ  ―  見た目
   ============================================================ */

:root {
  --accent: #2f6fb0;
  --accent-soft: #eaf2fa;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #e2e6ec;
  --text: #26303c;
  --muted: #6d7787;
  --ok: #2f8f6f;
  --warn: #c9862a;
  --ng: #c94a4a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 45, .07), 0 6px 18px rgba(20, 30, 45, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
}

body {
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }

/* ---------- ヘッダー ---------- */
.header {
  height: 58px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
  transition: background .25s;
}
.header__logo {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.header__school {
  font-size: 12px;
  opacity: .82;
  white-space: nowrap;
}
.header__spacer { flex: 1; }

.roleswitch { display: flex; gap: 6px; background: rgba(255,255,255,.16); padding: 4px; border-radius: 999px; }
.roleswitch button {
  border: 0; background: transparent; color: #fff;
  font-size: 13px; padding: 5px 13px; border-radius: 999px;
  white-space: nowrap; opacity: .85;
}
.roleswitch button.is-on { background: #fff; color: var(--accent); font-weight: 700; opacity: 1; }

.header__who { font-size: 12.5px; opacity: .9; white-space: nowrap; }

/* ---------- レイアウト ---------- */
.layout { display: flex; min-height: calc(100vh - 58px); align-items: stretch; }

.side {
  width: 236px; flex: 0 0 236px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 12px 10px 30px;
}
.side__cap {
  font-size: 11.5px; color: var(--muted); font-weight: 700;
  padding: 6px 10px 8px; letter-spacing: .04em;
}
.side__item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; border: 0; background: transparent;
  padding: 9px 10px; border-radius: 8px;
  font-size: 14.5px; color: var(--text); text-align: left;
  margin-bottom: 2px; white-space: nowrap;
}
.side__item:hover { background: #f0f3f7; }
.side__item.is-on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.side__ico { font-size: 15px; width: 20px; text-align: center; flex: 0 0 20px; }

.main { flex: 1; padding: 20px 24px 60px; min-width: 0; }

/* ---------- 画面の見出し ---------- */
.page__head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.page__title { font-size: 24px; font-weight: 700; margin: 0; line-height: 1.3; }
.page__sub { font-size: 12.5px; color: var(--muted); }

.timesave {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--ok);
  border-radius: 8px; padding: 6px 12px; font-size: 12.5px;
  box-shadow: var(--shadow);
}
.timesave b { color: var(--ng); font-weight: 700; }
.timesave i { font-style: normal; color: var(--ok); font-weight: 700; font-size: 14px; }

/* ---------- カード ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 14px;
}
.card__title { font-size: 16px; font-weight: 700; margin: 0 0 10px; }
.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- ボタン ---------- */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 8px 15px; border-radius: 8px; font-size: 14px;
}
.btn:hover { background: #f5f7fa; }
.btn--main { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn--main:hover { filter: brightness(1.07); background: var(--accent); }
.btn--ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 700; }
.btn--ok:hover { filter: brightness(1.07); background: var(--ok); }
.btn--sm { padding: 5px 11px; font-size: 12.5px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- テーブル ---------- */
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }
table.t th { background: #f7f9fb; font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
table.t tr:hover td { background: #fafbfd; }

/* ---------- タグ ---------- */
.tag {
  display: inline-block; font-size: 11.5px; padding: 1px 8px;
  border-radius: 999px; background: #eef1f5; color: var(--muted); white-space: nowrap;
}
.tag--ok { background: #e6f4ee; color: var(--ok); }
.tag--warn { background: #fbf1e0; color: var(--warn); }
.tag--ng { background: #fbeaea; color: var(--ng); }
.tag--accent { background: var(--accent-soft); color: var(--accent); }

.muted { color: var(--muted); font-size: 12.5px; }

/* ---------- ホーム ---------- */
.stat { text-align: center; padding: 14px 10px; }
.stat__num { font-size: 28px; font-weight: 700; line-height: 1.2; color: var(--accent); }
.stat__lab { font-size: 12px; color: var(--muted); }

.news { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; margin-bottom: 8px;
  font-size: 14px; text-align: left; }
.news:hover { background: #f7f9fc; }
.news__ico { font-size: 17px; }
.news__go { margin-left: auto; color: var(--muted); font-size: 12px; }

.savebar { height: 9px; background: #eef1f5; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.savebar > i { display: block; height: 100%; background: var(--ok); }

/* ---------- 出席 ---------- */
.att { display: grid; grid-template-columns: repeat(auto-fill, minmax(186px, 1fr)); gap: 8px; }
.att__cell {
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  padding: 8px 10px; font-size: 13px; text-align: left; display: flex; align-items: center; gap: 8px;
}
.att__cell:hover { border-color: var(--accent); }
.att__no { font-size: 11.5px; color: var(--muted); width: 20px; flex: 0 0 20px; }
.att__nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att__st { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.st-present { background: #e6f4ee; color: var(--ok); }
.st-absent  { background: #fbeaea; color: var(--ng); }
.st-late    { background: #fbf1e0; color: var(--warn); }

/* ---------- 時間割 ---------- */
table.tt { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tt th, table.tt td { border: 1px solid var(--line); padding: 9px 6px; text-align: center; }
table.tt th { background: #f7f9fb; font-size: 12px; color: var(--muted); }
table.tt td { background: #fff; }
.sub-国語 { background: #fdf0ef !important; }
.sub-算数 { background: #eef4fd !important; }
.sub-理科 { background: #eef8f2 !important; }
.sub-社会 { background: #fdf7e8 !important; }
.sub-体育 { background: #f0f7fd !important; }
.sub-音楽 { background: #f7f0fb !important; }
.sub-図工 { background: #fdf2f8 !important; }

/* ---------- チャット ---------- */
.chat { display: grid; grid-template-columns: 210px 1fr; gap: 0; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.chat__list { border-right: 1px solid var(--line); background: #fafbfd; padding: 8px; max-height: 520px; overflow-y: auto; }
.chat__room { width: 100%; border: 0; background: transparent; text-align: left; padding: 9px 10px;
  border-radius: 8px; font-size: 13.5px; margin-bottom: 2px; }
.chat__room:hover { background: #eff2f7; }
.chat__room.is-on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.chat__room small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.chat__room.is-on small { color: var(--accent); opacity: .8; }
.chat__body { display: flex; flex-direction: column; height: 520px; }
.chat__logs { flex: 1; overflow-y: auto; padding: 14px; background: #f7f9fc; }
.msg { max-width: 74%; margin-bottom: 12px; }
.msg__who { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.msg__bub { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px; font-size: 13.5px; }
.msg--mine { margin-left: auto; }
.msg--mine .msg__who { text-align: right; }
.msg--mine .msg__bub { background: var(--accent-soft); border-color: #cfe0f2; }
.chat__form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: #fff; }
.chat__form input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
  font-size: 14px; font-family: inherit; }

/* ---------- 入力まわり ---------- */
select, textarea, input[type="text"] {
  font-family: inherit; font-size: 14px; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; background: #fff;
}
textarea { width: 100%; line-height: 1.8; resize: vertical; }
label.f { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }

/* ---------- プリント ---------- */
.sheet {
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 26px 30px; box-shadow: var(--shadow);
}
.sheet__head { border-bottom: 2px solid var(--text); padding-bottom: 10px; margin-bottom: 18px;
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.sheet__t { font-size: 18px; font-weight: 700; }
.sheet__nm { margin-left: auto; font-size: 12.5px; border-bottom: 1px solid var(--text); padding: 0 44px 2px 6px; }
.qlist { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 26px; }
.q { font-size: 14px; padding-bottom: 8px; border-bottom: 1px dotted #ccd3dc; }
.q b { color: var(--accent); margin-right: 7px; }

.marks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.mark { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; font-size: 13px; }
.mark__nm { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.mark__sc { font-weight: 700; }
.mark__dots { margin-top: 5px; letter-spacing: 2px; font-size: 12px; }
.dot-o { color: var(--ok); }
.dot-x { color: var(--ng); }

/* ---------- 進行アニメ ---------- */
.runbar { height: 10px; background: #eef1f5; border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.runbar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .18s linear; }
.runlog { font-size: 12.5px; color: var(--muted); min-height: 22px; }

/* ---------- そのほか ---------- */
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; }

.flow { list-style: none; margin: 0; padding: 0; }
.flow li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.flow li:last-child { border-bottom: 0; }
.flow__t { flex: 0 0 52px; font-weight: 700; color: var(--accent); font-size: 13px; }
.flow__w { flex: 0 0 168px; font-weight: 700; }
.flow__h { flex: 1; color: var(--muted); }

.hint { background: #fffdf5; border: 1px solid #f0e4c4; border-radius: 8px; padding: 11px 14px;
  font-size: 12.5px; color: #6b5a2c; }

@media (max-width: 900px) {
  .layout { display: block; }
  .side { width: auto; flex: none; border-right: 0; border-bottom: 1px solid var(--line);
    display: flex; gap: 4px; overflow-x: auto; padding: 8px; }
  .side__cap { display: none; }
  .side__item { width: auto; white-space: nowrap; margin: 0; }
  .main { padding: 16px 14px 50px; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; }
  .chat__list { max-height: 150px; border-right: 0; border-bottom: 1px solid var(--line); display: flex; gap: 6px; overflow-x: auto; }
  .chat__room { white-space: nowrap; width: auto; }
  .qlist { grid-template-columns: 1fr; }
  .header { padding: 0 12px; gap: 10px; }
  .header__school, .header__who { display: none; }
}
