/* 夜間電話当番 — 事務用だが落ち着いて見えるように。夜空の紺と月の金を基調にする */
:root {
  --navy-950: #071427; --navy-900: #0b1d36; --navy-800: #12294a; --navy-700: #1b3a66; --navy-100: #e6ecf5; --navy-50: #f3f6fb;
  --gold: #f2b544; --gold-soft: #fff4d6;
  --bg: #f4f6fa; --card: #ffffff; --ink: #0f1b2d; --ink-2: #3a4a60; --muted: #6b7a90; --line: #e1e6ee; --line-2: #cfd7e3;
  --danger: #c0352b; --warn: #b26a00; --ok: #1f8a4c;
  --sat: #2f6fd1; --sun: #d2453b; --sat-bg: #f1f6ff; --sun-bg: #fff5f2; --hol-bg: #fff7e0;
  --line-green: #06c755;
  --radius: 14px; --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 6px 24px rgba(15, 27, 45, .06);
  --font: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.65 var(--font); font-feature-settings: "palt"; }
a { color: var(--navy-700); }
h1 { font-size: 1.45rem; letter-spacing: .02em; margin: 4px 0 14px; }
h2 { font-size: 1.05rem; margin: 28px 0 10px; color: var(--ink-2); letter-spacing: .04em; }
.muted { color: var(--muted); } .small { font-size: .84rem; }
main { max-width: 1120px; margin: 0 auto; padding: 20px 20px 40px; }

/* ---------- ヘッダー */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 60px;
  background: linear-gradient(100deg, var(--navy-950), var(--navy-800)); color: #fff; box-shadow: 0 2px 12px rgba(7, 20, 39, .25); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; flex: none; }
.brand svg { width: 30px; height: 30px; }
.brand .bt { display: flex; flex-direction: column; line-height: 1.15; }
.brand small { font-size: .66rem; color: #a9b8cf; letter-spacing: .06em; }
.brand b { font-size: 1rem; letter-spacing: .08em; }
#nav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
#nav::-webkit-scrollbar { display: none; }
#nav a { color: #c9d4e5; text-decoration: none; padding: 7px 12px; border-radius: 8px; font-size: .9rem; white-space: nowrap; }
#nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
#nav a.on { color: #fff; background: rgba(255, 255, 255, .12); box-shadow: inset 0 -2px 0 var(--gold); }
#nav .sp { flex: 1; }
#nav .who { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: #c9d4e5; font-size: .85rem; padding-left: 8px; }
#nav .who .av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--navy-900); font-weight: 700; font-size: .78rem; }

.credit { text-align: center; font-size: .75rem; color: var(--muted); padding: 24px 16px 32px; }
.credit a { color: var(--ink-2); text-decoration: none; font-weight: 600; }

/* ---------- 部品 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 14px 0; box-shadow: var(--shadow); }
.card-t { display: block; font-size: .95rem; font-weight: 700; margin-bottom: 6px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 10px; font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover, button:hover { border-color: var(--navy-700); }
.btn:active, button:active { transform: translateY(1px); }
.btn.primary, button.primary { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn.primary:hover, button.primary:hover { background: var(--navy-700); }
button.danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
.btn.line { background: var(--line-green); border-color: var(--line-green); color: #fff; }
.btn.line:hover { filter: brightness(1.05); border-color: var(--line-green); }
.btn.big { width: 100%; padding: 14px 18px; font-size: 1.02rem; border-radius: 12px; }
.btn svg { width: 22px; height: 22px; }
input, select, textarea { font: inherit; font-size: .92rem; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--ink); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(27, 58, 102, .25); border-color: var(--navy-700); }
textarea { width: 100%; min-height: 72px; }
label { display: inline-flex; gap: 6px; align-items: center; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .04em; vertical-align: middle; }
.badge.collecting { background: #e6f0ff; color: #1f57b8; }
.badge.draft { background: #fff1d9; color: #9a5b00; }
.badge.published { background: #e3f5ea; color: #1b7a43; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.page-head h1 { flex: 1; margin: 0; }
.kicker { font-size: .75rem; letter-spacing: .12em; color: var(--muted); font-weight: 700; }

/* ホーム: 次の当番 */
.hero { position: relative; overflow: hidden; border-radius: 18px; padding: 22px 22px 20px; color: #fff; margin: 6px 0 16px;
  background: radial-gradient(120% 140% at 100% 0%, #2a4f86 0%, var(--navy-900) 55%, var(--navy-950) 100%); box-shadow: 0 10px 30px rgba(11, 29, 54, .25); }
.hero::after { content: ""; position: absolute; right: -30px; top: -30px; width: 140px; height: 140px; border-radius: 50%; box-shadow: -22px 18px 0 0 var(--gold); opacity: .9; }
.hero .k { font-size: .78rem; letter-spacing: .14em; color: #a9b8cf; }
.hero .d { font-size: 2.1rem; font-weight: 800; letter-spacing: .02em; line-height: 1.2; margin: 6px 0 2px; }
.hero .s { color: #d5dfee; font-size: .92rem; }
.hero .role { display: inline-block; background: var(--gold); color: var(--navy-900); font-weight: 800; border-radius: 6px; padding: 0 8px; margin-right: 8px; font-size: .9rem; vertical-align: middle; }
.notice { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; border-left: 4px solid var(--gold); }
.notice .grow { flex: 1; min-width: 200px; }
.duty-list { list-style: none; margin: 6px 0 0; padding: 0; }
.duty-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.duty-list li:last-child { border-bottom: 0; }
.duty-list .tag { min-width: 44px; text-align: center; font-size: .78rem; font-weight: 800; border-radius: 6px; padding: 1px 6px; background: var(--navy-100); color: var(--navy-800); }
.duty-list .tag.second { background: #e8e4ff; color: #4b3cb3; } .duty-list .tag.coop { background: var(--gold-soft); color: #8a5a00; }
.links a { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; }
.links a:last-child { border-bottom: 0; }

/* ---------- カレンダー */
.months { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); }
.month { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.month h3 { margin: 0 0 8px; font-size: 1rem; letter-spacing: .04em; }
.cal { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.cal th { font-size: .74rem; font-weight: 700; color: var(--muted); padding: 2px 0 6px; }
.cal th.d6 { color: var(--sat); } .cal th.d0 { color: var(--sun); }
.cal td { border-top: 1px solid var(--line); border-left: 1px solid var(--line); vertical-align: top; padding: 3px; height: 66px; }
.cal tr td:last-child { border-right: 1px solid var(--line); }
.cal tr:last-child td { border-bottom: 1px solid var(--line); }
.cal tr:nth-child(2) td:first-child { border-top-left-radius: 8px; } .cal tr:nth-child(2) td:last-child { border-top-right-radius: 8px; }
.cal tr:last-child td:first-child { border-bottom-left-radius: 8px; } .cal tr:last-child td:last-child { border-bottom-right-radius: 8px; }
.cal td.empty { background: repeating-linear-gradient(135deg, #fafbfd 0 6px, #f3f5f9 6px 12px); }
.cal td.d6 { background: var(--sat-bg); } .cal td.d0 { background: var(--sun-bg); } .cal td.hol { background: var(--hol-bg); }
.cal td.today { box-shadow: inset 0 0 0 2px var(--gold); }
.dn { font-size: .76rem; font-weight: 800; display: flex; justify-content: space-between; gap: 2px; color: var(--ink-2); }
.d0 .dn, .hol .dn { color: var(--sun); } .d6 .dn { color: var(--sat); }
.hn { font-size: .6rem; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.slot { display: flex; align-items: center; gap: 3px; font-size: .78rem; line-height: 1.35; margin-top: 2px; }
.slot .r { font-size: .64rem; color: var(--muted); width: 1.3em; flex: none; text-align: center; font-weight: 700; }
.pill { border-radius: 5px; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #13202f; flex: 1; min-width: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); font-weight: 600; }
.pill.me { box-shadow: 0 0 0 2px var(--navy-900); }
.pill.muted { background: transparent; box-shadow: none; }
.slot select { -webkit-appearance: none; appearance: none; font-size: .76rem; padding: 0 4px; width: 100%; min-width: 0; border-radius: 5px; font-weight: 600; border: 1px solid rgba(0, 0, 0, .12); color: #13202f; text-overflow: ellipsis; cursor: pointer; line-height: 1.5; }
.slot select:hover { border-color: var(--navy-700); }
.slot select:not([style]) { background: #fff; border-style: dashed; color: var(--muted); }
.slot select.locked { border: 2px solid var(--navy-800); }
.slot { position: relative; }
.slot .lk { position: absolute; right: -3px; top: -5px; cursor: pointer; font-size: .6rem; border: 0; background: none; padding: 0; line-height: 1; }
.cal td.err { box-shadow: inset 0 0 0 2px var(--danger); }
.cal td.wrn { box-shadow: inset 0 0 0 2px #e8a33a; }

/* 希望入力 */
.cal.req td { height: 54px; cursor: pointer; user-select: none; text-align: center; transition: background .1s; }
.cal.req td:hover { background: var(--navy-50); }
.cal.req td.out { cursor: default; opacity: .4; }
.mark { font-size: 1.45rem; line-height: 1.15; font-weight: 800; }
.mark.ng { color: var(--danger); } .mark.want { color: var(--ok); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .9rem; align-items: center; }
.legend .mark { font-size: 1.1rem; }
.sticky-save { position: sticky; bottom: 12px; z-index: 5; }

/* 表 */
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.grid th { background: var(--navy-50); color: var(--ink-2); font-size: .8rem; font-weight: 700; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: center; font-size: .9rem; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid td.l, table.grid th.l { text-align: left; }
table.grid td.hi { background: #ffecea; color: #a12a20; font-weight: 700; } table.grid td.lo { background: #e9f1ff; color: #1f57b8; font-weight: 700; }
table.grid .pill { display: inline-block; }
.scroll { overflow-x: auto; }
.issues { margin: 8px 0 0; padding-left: 18px; }
.issues li.error { color: var(--danger); } .issues li.warn { color: var(--warn); } .issues li.info { color: var(--muted); }
.swatch { width: 30px; height: 26px; padding: 0; border: 1px solid var(--line-2); border-radius: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: .84rem; background: #fff; text-decoration: none; color: var(--ink); font-weight: 600; }
.chip.done { background: #e3f5ea; border-color: #a6dcbb; color: #1b7a43; }
.chip.todo { border-style: dashed; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy-900); color: #fff; padding: 11px 20px; border-radius: 12px; z-index: 30; max-width: 90vw; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); font-weight: 600; }
.toast.err { background: var(--danger); }
.form-grid { display: grid; grid-template-columns: max-content 1fr; gap: 10px 14px; align-items: center; }

/* 登録用 QR */
.qr-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: center; }
.qr-box { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px; }
.qr-box svg { display: block; width: 100%; height: auto; }
.qr-url { font-size: .78rem; color: var(--muted); word-break: break-all; }
.qr-poster { display: none; }

/* ---------- ログイン前の画面 */
body.gate { min-height: 100vh; background:
  radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%), radial-gradient(1px 1px at 72% 12%, #fff9 50%, transparent 51%),
  radial-gradient(1.5px 1.5px at 85% 40%, #fff7 50%, transparent 51%), radial-gradient(1px 1px at 30% 70%, #fff6 50%, transparent 51%),
  radial-gradient(1px 1px at 55% 30%, #fff5 50%, transparent 51%), radial-gradient(1.5px 1.5px at 20% 45%, #fff6 50%, transparent 51%),
  radial-gradient(1px 1px at 92% 78%, #fff6 50%, transparent 51%), radial-gradient(1px 1px at 8% 88%, #fff5 50%, transparent 51%),
  radial-gradient(120% 90% at 80% 0%, #2a4f86 0%, var(--navy-900) 50%, var(--navy-950) 100%); background-attachment: fixed; color: var(--ink); }
.gate-main { max-width: 440px; margin: 0 auto; padding: 56px 16px 32px; }
.gate-card { background: #fff; border-radius: 22px; padding: 28px 24px 26px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.gate-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.gate-brand svg { width: 46px; height: 46px; background: var(--navy-900); border-radius: 12px; padding: 6px; flex: none; }
.gate-org { font-size: .74rem; color: var(--muted); letter-spacing: .08em; }
.gate-app { font-size: 1.25rem; font-weight: 800; letter-spacing: .1em; }
.gate-card h1 { font-size: 1.35rem; margin: 0 0 6px; }
.gate-card .lead { color: var(--ink-2); margin: 0 0 20px; }
.gate-card .hint { color: var(--muted); font-size: .85rem; margin: 16px 0 0; }
.gate-card .dev { font-size: .8rem; margin-top: 14px; }
.steps { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-weight: 600; }
.steps span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-100); color: var(--navy-800); font-weight: 800; flex: none; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.pick button, .pick .btn { justify-content: flex-start; padding: 12px 14px; font-size: 1rem; border-radius: 12px; }
.pick i { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.ad { margin-top: 26px; color: #c9d4e5; text-align: center; }
.ad-by { font-size: .78rem; margin-bottom: 12px; }
.ad-by a { color: #fff; text-decoration: none; }

/* ---------- スマホ */
@media (max-width: 640px) {
  main { padding: 14px 10px 32px; }
  .top { padding: 0 12px; gap: 10px; height: 56px; }
  .brand .bt small { display: none; }
  #nav .who .nm { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .qr-wrap { grid-template-columns: 1fr; }
  .month { padding: 6px; border-radius: 12px; }
  .cal td { height: 58px; padding: 1px; }
  .slot { font-size: .72rem; gap: 1px; }
  .slot .r { width: .9em; font-size: .58rem; }
  .pill { padding: 0 1px; text-overflow: clip; letter-spacing: -.03em; border-radius: 4px; }
  .hero .d { font-size: 1.8rem; }
}

/* ---------- 印刷: 紙の勤務表に近い形 */
.print-only { display: none; }
@media print {
  @page { size: A4 portrait; margin: 8mm; }
  body { background: #fff; font-size: 10px; }
  .no-print, .top, .credit, .toast { display: none !important; }
  .print-only { display: block; }
  main { padding: 0; max-width: none; }
  .months { grid-template-columns: 1fr 1fr; gap: 6px; }
  .month { border: 0; padding: 0; box-shadow: none; break-inside: avoid; }
  .cal td { height: auto; border-color: #777 !important; }
  .cal th { font-size: 9px; }
  .pill, .cal td, table.grid td, table.grid th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pill, .pill.me { font-size: 9px; box-shadow: none; }
  .cal td.today { box-shadow: none; }
  table.grid { border-radius: 0; }
  table.grid th, table.grid td { font-size: 9px; padding: 1px 4px; }
  body.print-qr main > :not(.qr-poster) { display: none !important; }
  body.print-qr .qr-poster { display: block; text-align: center; padding-top: 24mm; }
  .qr-poster h1 { font-size: 30px; margin: 0 0 6px; } .qr-poster p { font-size: 15px; margin: 4px 0; }
  .qr-poster svg { width: 110mm; height: 110mm; margin: 10mm auto; display: block; }
}
