/* 保育園シフト作成 共通の見た目（index.html / admin.html） */
:root {
  --main: #0f766e;
  --main-dark: #115e59;
  --main-soft: #ccfbf1;
  --bg: #f6f7f4;
  --card: #ffffff;
  --ink: #1f2937;
  --sub: #4b5563;
  --line: #d1d5db;
  --warn: #b91c1c;
  --warn-soft: #fee2e2;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --closed: #e5e7eb;
  --sat: #1d4ed8;
  --sun: #b91c1c;
}
* { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", Meiryo, sans-serif;
  line-height: 1.6; overflow-wrap: break-word; word-break: normal;
}
main { max-width: 44rem; margin: 0 auto; padding: 1rem 1rem 2rem; }
main.wide { max-width: 100rem; }
main.wide .msg, main.wide .monthnav, main.wide .row, main.wide > section > p { max-width: 60rem; margin-left: auto; margin-right: auto; }
h1 { font-size: 1.4rem; margin: 0.3rem 0 0.8rem; line-height: 1.4; }
h2 { font-size: 1.2rem; margin: 1.2rem 0 0.6rem; }
p { margin: 0.4rem 0; }
.sub { color: var(--sub); font-size: 0.92rem; }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }

.screen { display: none; }
.screen.on { display: block; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.back {
  min-height: 2.75rem; padding: 0.4rem 0.9rem; border-radius: 0.6rem; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 1rem; cursor: pointer;
}
.brand { color: var(--main-dark); font-weight: bold; font-size: 0.95rem; }

.card { background: var(--card); border-radius: 0.9rem; padding: 1rem; margin: 0.8rem 0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }

button, .btn { font-family: inherit; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem; flex-wrap: wrap;
  width: 100%; min-height: 3.2rem; padding: 0.7rem 1rem; margin: 0.5rem 0;
  border-radius: 0.8rem; border: 2px solid var(--main); background: #fff; color: var(--main-dark);
  font-size: 1.05rem; font-weight: bold; cursor: pointer; text-align: center; text-decoration: none;
}
.btn.primary { background: var(--main); color: #fff; }
.btn.danger { border-color: var(--warn); color: var(--warn); }
.btn.attn { background: #fff7ed; border-color: #ea580c; color: #9a3412; }
.btn.big { min-height: 4.2rem; font-size: 1.15rem; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn .badge { background: #ea580c; color: #fff; border-radius: 1rem; padding: 0 0.6rem; font-size: 0.9rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.row > .btn { flex: 1 1 10rem; width: auto; }

.menu .btn { justify-content: flex-start; text-align: left; }
.menu .btn .ic { font-size: 1.4rem; }
.menu .btn .tx { flex: 1 1 8rem; }
.menu .btn .tx small { display: block; font-weight: normal; font-size: 0.85rem; color: var(--sub); }
.menu .btn.primary .tx small { color: #e6fffa; }

label.f { display: block; font-weight: bold; margin: 0.9rem 0 0.3rem; }
input[type=text], input[type=password], input[type=number], input[type=time], input[type=tel], select, textarea {
  width: 100%; min-height: 3rem; padding: 0.5rem 0.7rem; font-size: 1.1rem; font-family: inherit;
  border: 1px solid #9ca3af; border-radius: 0.6rem; background: #fff; color: var(--ink);
}
textarea { min-height: 5rem; }
input.pin { font-size: 1.6rem; letter-spacing: 0.4em; text-align: center; }
.check { display: flex; align-items: center; gap: 0.6rem; min-height: 2.75rem; cursor: pointer; }
.check input { width: 1.5rem; height: 1.5rem; flex: 0 0 auto; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  min-height: 2.75rem; min-width: 2.75rem; padding: 0.3rem 0.8rem; border-radius: 0.6rem;
  border: 2px solid var(--line); background: #fff; font-size: 1rem; cursor: pointer; color: var(--ink);
}
.chip.on { border-color: var(--main); background: var(--main-soft); font-weight: bold; }

.msg { padding: 0.7rem 0.9rem; border-radius: 0.6rem; margin: 0.6rem 0; }
.msg.err { background: var(--warn-soft); color: var(--warn); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.info { background: #eff6ff; color: #1e3a8a; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid #e5e7eb; }
.list li:last-child { border-bottom: 0; }
.list .item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; width: 100%; min-height: 3.2rem;
  padding: 0.6rem 0.4rem; background: none; border: 0; text-align: left; font-size: 1rem; cursor: pointer; color: var(--ink);
}
.list .item .grow { flex: 1 1 10rem; }

.pat { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; min-height: 2rem; padding: 0 0.3rem; border-radius: 0.4rem; font-weight: bold; }

/* シフト表 */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 0.6rem; background: #fff; }
table.shift { border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
table.shift th, table.shift td { border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; text-align: center; padding: 0; }
table.shift thead th { position: sticky; top: 0; background: #f9fafb; z-index: 2; font-weight: normal; padding: 0.2rem 0; min-width: 2.4rem; }
table.shift thead th.d .n { display: block; font-weight: bold; }
table.shift thead th.sat { color: var(--sat); }
table.shift thead th.sun { color: var(--sun); }
table.shift .name {
  position: sticky; left: 0; z-index: 1; background: #fff; text-align: left; padding: 0.2rem 0.5rem;
  min-width: 6.5rem; max-width: 8rem; font-weight: bold; line-height: 1.3;
}
table.shift .name small { display: block; font-weight: normal; color: var(--sub); font-size: 0.75rem; }
table.shift thead th.name { z-index: 3; background: #f9fafb; }
table.shift td.c { min-width: 2.4rem; height: auto; }
table.shift td.c button, table.shift td.c span.v {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 2.75rem;
  border: 0; background: transparent; font-size: 1rem; font-weight: bold; cursor: pointer; position: relative; color: var(--ink); padding: 0;
}
table.shift td.closed { background: var(--closed); }
table.shift td.c .req { position: absolute; top: 0.1rem; right: 0.15rem; font-size: 0.6rem; color: #9a3412; font-weight: bold; }
table.shift td.c.warn button { outline: 3px solid var(--warn); outline-offset: -3px; }
table.shift td.c.today, table.shift thead th.today { box-shadow: inset 0 0 0 2px var(--main); }
table.shift tfoot td { background: #f9fafb; font-size: 0.85rem; padding: 0.2rem 0; }
table.shift tfoot td.short { background: var(--warn-soft); color: var(--warn); font-weight: bold; }
table.shift tfoot td.good { color: var(--ok); }
table.shift tfoot td button { width: 100%; min-height: 2.75rem; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
table.shift .sum { min-width: 3.2rem; padding: 0 0.3rem; font-size: 0.85rem; }
table.shift tr.off .name { color: var(--sub); }

.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; margin: 0.6rem 0; font-size: 0.9rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.3rem; }

/* 月の切り替え */
.monthnav { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem; margin: 0.4rem 0 0.6rem; }
.monthnav .m { font-size: 1.3rem; font-weight: bold; min-width: 8rem; text-align: center; }
.monthnav button { min-height: 2.75rem; min-width: 2.75rem; border-radius: 0.6rem; border: 1px solid var(--line); background: #fff; font-size: 1.1rem; cursor: pointer; }
.status { display: inline-block; padding: 0.1rem 0.7rem; border-radius: 1rem; font-size: 0.9rem; font-weight: bold; }
.status.draft { background: #fef3c7; color: #92400e; }
.status.pub { background: var(--ok-soft); color: var(--ok); }

/* 下から出る選択 */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 50; display: none; }
.sheet-bg.on { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: #fff; border-radius: 1rem 1rem 0 0;
  padding: 1rem 1rem 1.4rem; max-height: 85%; overflow-y: auto; display: none; max-width: 40rem; margin: 0 auto;
}
.sheet.on { display: block; }
.sheet h3 { margin: 0 0 0.4rem; font-size: 1.15rem; }
.patgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: 0.5rem; margin: 0.6rem 0; }
.patgrid button {
  min-height: 3.4rem; border-radius: 0.7rem; border: 2px solid transparent; font-size: 1rem; font-weight: bold; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0.3rem; color: var(--ink);
}
.patgrid button small { font-weight: normal; font-size: 0.8rem; }
.patgrid button.cur { border-color: var(--ink); }

/* 下に固定する確認バー */
.stickybar {
  position: sticky; bottom: 0; z-index: 20; background: #fffbeb; border: 2px solid #f59e0b; border-radius: 0.8rem;
  padding: 0.6rem 0.8rem; margin-top: 0.8rem; box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

/* 人数の帯 */
.band { margin: 0.6rem 0; }
.band .bar { height: 0.9rem; border-radius: 0.5rem; background: #e5e7eb; overflow: hidden; }
.band .bar i { display: block; height: 100%; background: var(--main); }
.band.short .bar i { background: var(--warn); }
.band .lb { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem; }

/* カレンダー（希望を出す） */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.25rem; }
.cal .h { text-align: center; font-size: 0.85rem; color: var(--sub); }
.cal button {
  min-height: 3.4rem; border-radius: 0.5rem; border: 1px solid var(--line); background: #fff; font-size: 1rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0.1rem; color: var(--ink);
}
.cal button small { font-size: 0.65rem; line-height: 1.2; }
.cal button.closed { background: var(--closed); color: #9ca3af; cursor: default; }
.cal button.off { background: #fed7aa; border-color: #ea580c; font-weight: bold; }
.cal button.no_early, .cal button.no_late { background: #e0e7ff; border-color: #4f46e5; }
.cal .blank { min-height: 3.4rem; }

/* 自分のシフト */
.mylist .day { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.55rem 0.3rem; border-bottom: 1px solid #e5e7eb; }
.mylist .day .dt { flex: 0 0 7.5rem; font-weight: bold; }
.mylist .day.today { background: var(--main-soft); border-radius: 0.5rem; }
.mylist .day.closedday { color: #9ca3af; }

footer { text-align: center; color: var(--sub); font-size: 0.85rem; padding: 1.5rem 1rem 2rem; }

.printhead { display: none; }
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body { background: #fff; }
  .noprint, .topbar, footer, .stickybar, .legend.noprint { display: none !important; }
  main { padding: 0; max-width: none; }
  .printhead { display: block; font-size: 1rem; font-weight: bold; margin-bottom: 0.3rem; }
  .tablewrap { overflow: visible; border: 0; }
  table.shift { font-size: 0.6rem; width: 100%; }
  table.shift thead th { position: static; min-width: 0; }
  table.shift .name { position: static; min-width: 4.5rem; }
  table.shift td.c { min-width: 0; }
  table.shift td.c button, table.shift td.c span.v { min-height: 1.4rem; font-size: 0.7rem; }
  table.shift td.c.warn button { outline: 0; }
  table.shift tfoot td button { min-height: 1.2rem; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
