/* =========================================================
   佐伯システム — 希望シフト提出画面
   LINEアプリ内ブラウザ / スマホ縦画面前提
   ========================================================= */

:root {
  --line-green: #06c755;
  --line-green-dark: #05a648;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1f2328;
  --text-sub: #8a9099;
  --border: #e4e6ea;
  --sun: #e8503a;
  --sat: #2f7de6;
  --warn: #b8860b;
  --error: #b00020;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .07), 0 8px 24px rgba(0, 0, 0, .04);
  --footer-h: 88px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.6;
  font-size: 16px;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: calc(var(--footer-h) + env(safe-area-inset-bottom));
}

/* ---- ヘッダー ---- */

.app-header {
  background: var(--line-green);
  color: #fff;
  padding: 18px 20px 20px;
}

.app-title { margin: 0; font-size: 18px; font-weight: 700; }
.app-deadline { margin: 4px 0 0; font-size: 12px; opacity: .92; }

/* 管理画面は色を変えて、提出画面と取り違えないようにする */
.app-header-admin { background: #2f6fae; }

/* ---- 入力パネル（管理画面） ---- */

.panel {
  margin: 12px 12px 0;
  padding: 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
}

.month-picker { display: flex; align-items: center; gap: 8px; }

.month-nav {
  width: 40px; height: 44px;
  flex: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.month-nav:active { background: var(--bg); }

.month-input, .date-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.month-input:focus, .date-input:focus {
  outline: none;
  border-color: #2f6fae;
  background: var(--surface);
}

/* ---- 日付の選択（管理画面） ---- */

.pickday {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.pickday.is-on { border-color: #2f6fae; background: #eef5fc; }
.pickday:active { transform: scale(.995); }

.pickday-date {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.pickday-date.is-sun { color: var(--sun); }
.pickday-date.is-sat { color: var(--sat); }
.pickday-date .dow { font-size: 12px; font-weight: 500; color: var(--text-sub); margin-left: 3px; }

.pickday-mark {
  width: 28px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #2f6fae;
  line-height: 1;
}

/* 管理画面のフッターボタンもヘッダーと同じ色に揃える */
.app-header-admin ~ .app-footer .submit-btn { background: #2f6fae; }
.app-header-admin ~ .app-footer .submit-btn:active:not(:disabled) { background: #25587f; }

/* ---- ステータス ---- */

.status {
  margin: 12px 12px 0;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text-sub);
}
.status.is-error { color: var(--error); background: #ffe8e8; box-shadow: none; }

/* ---- 一括操作 ---- */

.bulk {
  display: flex;
  gap: 8px;
  padding: 12px 12px 0;
}

.bulk-btn {
  flex: 1;
  font: inherit;
  font-size: 13px;
  padding: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  border-radius: 8px;
  cursor: pointer;
}
.bulk-btn:active { background: var(--bg); }

/* ---- 日ごとの行 ---- */

.days {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

.day {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-left: 3px solid transparent;
}
.day.is-answered { border-left-color: var(--line-green); }

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.day-date {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.day-date.is-sun { color: var(--sun); }
.day-date.is-sat { color: var(--sat); }
.day-date .dow { font-size: 12px; font-weight: 500; color: var(--text-sub); margin-left: 3px; }

/* ---- 〇 / × ---- */

.choice { display: flex; gap: 8px; }

.choice-btn {
  width: 52px;
  height: 40px;
  font-size: 18px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
}
.choice-btn:active { transform: scale(.96); }

.choice-yes.is-on {
  background: var(--line-green);
  border-color: var(--line-green);
  color: #fff;
}
.choice-no.is-on {
  background: #6b7280;
  border-color: #6b7280;
  color: #fff;
}

/* ---- 備考 ---- */

.note {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  min-height: 38px;
  resize: none;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}
.note:focus {
  outline: none;
  border-color: var(--line-green);
  background: var(--surface);
}
.note::placeholder { color: var(--text-sub); }

/* ---- フッター ---- */

.app-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.count {
  font-size: 12px;
  color: var(--text-sub);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.submit-btn {
  width: 100%;
  border: none;
  background: var(--line-green);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 14px;
  border-radius: 10px;
  cursor: pointer;
}
.submit-btn:active:not(:disabled) { background: var(--line-green-dark); }
.submit-btn:disabled { opacity: .55; cursor: default; }

/* ---- トースト ---- */

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--footer-h) + 16px + env(safe-area-inset-bottom));
  max-width: 90vw;
  width: max-content;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
  z-index: 10;
}
.toast.is-ok { background: #1f2937; }
.toast.is-warn { background: var(--warn); }
.toast.is-error { background: var(--error); }

/* ---- フォーカス可視 ---- */

button:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--line-green-dark);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .choice-btn:active,
  .pickday:active { transform: none; }
}
