/* v1（日程調整ボード）の配色・書体・表の見せ方を踏襲。インラインstyleは使わない（CSP）。 */
:root {
  color-scheme: light;
  --bg: #f4f6f5; --surface: #ffffff; --ink: #17211f; --muted: #536360; --line: #dbe2df;
  --accent: #0f6b5c; --accent-ink: #ffffff; --yes: #17735e; --yes-ink: #ffffff; --maybe: #d99a1e; --maybe-ink: #2f2000;
  --off: #eef2f0; --danger: #b4382f; --focus: #0b57d0;
  --f-body: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1514; --surface: #162020; --ink: #e6eeeb; --muted: #9aaba6; --line: #2a3633;
    --accent: #4cc2a6; --accent-ink: #06231d; --yes: #3bb391; --yes-ink: #04201a; --maybe: #e6b04a; --maybe-ink: #2f2000;
    --off: #1d2827; --danger: #ef7b70; --focus: #7fb0ff;
  }
}
* { box-sizing: border-box; }
html { font-size: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.65; }
.wrap { max-width: 980px; margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 24px; }
main, .stack { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
h1, h2, h3 { margin: 0; line-height: 1.35; text-wrap: balance; }
h1 { font-size: 1.6rem; font-weight: 700; } h1 a { color: inherit; text-decoration: none; }
h2 { font-size: 1.15rem; font-weight: 700; } h3 { font-size: .95rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand .tag { font-size: .8rem; letter-spacing: .08em; color: var(--muted); }
.brand .spacer { flex: 1; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.notice { border: 1px solid var(--line); border-left: 4px solid var(--maybe); background: var(--surface); padding: 12px 16px; border-radius: 6px; font-size: .9rem; }
.error { color: var(--danger); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pre { white-space: pre-wrap; }
[hidden] { display: none !important; }

button, .btn { font: inherit; font-size: .92rem; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 8px 14px; min-height: 40px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--muted); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
button.danger { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 45%, var(--line)); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.mini, .btn.mini { padding: 4px 10px; font-size: .82rem; min-height: 32px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; font-weight: 500; }
label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input[type=text], input[type=password], input[type=number], textarea, select {
  font: inherit; font-size: .95rem; color: var(--ink); background: var(--bg); border: 1px solid #8a9792; border-radius: 7px; padding: 9px 11px; width: 100%; max-width: 100%; min-height: 40px; }
input[type=number] { width: 6em; } select { width: auto; }
textarea { min-height: 64px; resize: vertical; }
.hint { font-size: .85rem; color: var(--muted); font-weight: 400; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row.center { align-items: center; } .row.end { justify-content: flex-end; }
.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: pointer; }
.check input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--accent); }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0; padding: 12px; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; font-size: .9rem; }
fieldset.plain { border: 0; padding: 0; }

/* タブ */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs [role=tab] { border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 14px; font-weight: 500; color: var(--muted); }
.tabs [role=tab][aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }

/* 調整の一覧 */
.events { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ev { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); text-decoration: none; }
.ev:hover { border-color: var(--accent); } .ev b { font-size: 1rem; }
.empty { padding: 22px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; font-size: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .8rem; padding: 2px 9px; border-radius: 99px; background: var(--off); border: 1px solid var(--line); display: inline-block; }
.pill { font-size: .75rem; padding: 2px 9px; border-radius: 99px; font-weight: 700; display: inline-block; }
.pill.ok { background: color-mix(in oklab, var(--yes) 20%, var(--surface)); border: 1px solid var(--yes); }
.pill.warn { background: color-mix(in oklab, var(--maybe) 22%, var(--surface)); border: 1px solid var(--maybe); }

/* カレンダー */
.cal { display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .wd { font-size: .75rem; text-align: center; color: var(--muted); } .cal-grid .sun { color: var(--danger); }
.cal-grid button { padding: 0; height: 40px; justify-content: center; font-family: var(--f-mono); font-size: .9rem; }
.cal-grid button.sun { color: var(--danger); }
.cal-grid button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }

/* 表 */
.scroll { overflow: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
table.grid { border-collapse: separate; border-spacing: 0; user-select: none; -webkit-user-select: none; }
table.grid th, table.grid td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
table.grid thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; font-size: .8rem; font-weight: 500; padding: 6px 4px; min-width: 64px; text-align: center; line-height: 1.3; }
table.grid thead th.corner { left: 0; z-index: 3; min-width: 0; }
table.grid th.t { position: sticky; left: 0; background: var(--surface); z-index: 1; font-family: var(--f-mono); font-size: .75rem; font-weight: 400; color: var(--muted); padding: 0 8px; text-align: right; white-space: nowrap; vertical-align: top; line-height: 1.2; }
table.grid th.rowh { position: sticky; left: 0; background: var(--surface); z-index: 1; padding: 0 12px; font-size: .82rem; font-weight: 500; white-space: nowrap; text-align: left; }
table.grid thead th.tt { min-width: 0; text-align: left; font-family: var(--f-mono); font-size: .72rem; font-weight: 400; color: var(--muted); border-left: 1px solid color-mix(in oklab, var(--muted) 45%, transparent); }
table.grid .wd0 { color: var(--danger); } table.grid .wd6 { color: #3b6fc4; }
table.grid .date-btn { font: inherit; color: inherit; background: none; border: 0; padding: 4px 6px; min-height: 28px; cursor: pointer; text-decoration: underline dotted; }
table.grid .date-btn:hover { color: var(--accent); }
table.grid tr.hour td, table.grid tr.hour th.t { border-top: 1px solid color-mix(in oklab, var(--muted) 45%, transparent); }
table.grid td { height: 26px; min-width: 64px; text-align: center; background: var(--off); cursor: pointer; touch-action: pan-x pan-y; font-family: var(--f-mono); font-size: .8rem; padding: 0; }
table.grid.h td { height: 42px; min-width: 28px; width: 28px; }
table.grid.h.st15 td { min-width: 22px; width: 22px; } table.grid.h.st60 td { min-width: 52px; width: 52px; }
table.grid td.hl { border-left: 1px solid color-mix(in oklab, var(--muted) 45%, transparent); }
table.grid.touch td { min-height: 44px; }
table.grid td:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; position: relative; z-index: 1; }
table.grid td.sel { box-shadow: inset 0 0 0 3px var(--focus); }
table.grid td.mk-y { background: var(--yes); color: var(--yes-ink); font-weight: 700; }
table.grid td.mk-m { background: var(--maybe); color: var(--maybe-ink); font-weight: 700; }
table.grid td.mk-n { color: var(--muted); font-size: .7rem; }
table.grid td.hm { font-size: .78rem; color: var(--ink); }
table.grid td.h1 { background: color-mix(in oklab, var(--yes) 18%, var(--off)); }
table.grid td.h2 { background: color-mix(in oklab, var(--yes) 38%, var(--off)); }
table.grid td.h3 { background: color-mix(in oklab, var(--yes) 58%, var(--off)); }
table.grid td.h4 { background: color-mix(in oklab, var(--yes) 80%, var(--off)); color: var(--yes-ink); }
table.grid td.h5 { background: var(--yes); color: var(--yes-ink); font-weight: 700; }
table.grid td.all { box-shadow: inset 0 0 0 2px var(--accent); }
table.grid td.picked { outline: 2px solid var(--ink); outline-offset: -2px; }
td .sub { font-size: .65rem; display: block; line-height: 1; opacity: .9; }
.gridbar { display: flex; justify-content: flex-end; }
.seg { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.seg button { padding: 5px 12px; font-size: .85rem; min-height: 36px; }
.seg button[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg .small { margin-right: 4px; }
.modes { display: flex; gap: 6px; flex-wrap: wrap; }
.modes label.tool { flex-direction: row; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; font-size: .92rem; position: relative; }
.modes label.tool input { position: absolute; opacity: 0; }
.modes label.tool:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 700; }
.modes label.tool:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid var(--line); vertical-align: middle; }
.sw.y { background: var(--yes); } .sw.m { background: var(--maybe); } .sw.o { background: var(--off); } .sw.all { box-shadow: inset 0 0 0 2px var(--accent); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.ramp { width: 90px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, var(--off), var(--yes)); }
.best { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.best li { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }
.best .rank { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); min-width: 1.5em; }
.best .when { font-weight: 700; } .best .cnt { font-size: .85rem; color: var(--muted); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 720px) { .two { grid-template-columns: minmax(0, 1fr); } }
.col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.detail { display: flex; flex-direction: column; gap: 8px; font-size: .9rem; }
.detail .grp { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.listhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
table.resp { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.resp th, table.resp td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.resp thead th { font-size: .78rem; color: var(--muted); font-weight: 500; letter-spacing: .04em; }
table.resp td.act { white-space: nowrap; text-align: right; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 8px; font-size: .9rem; z-index: 20; max-width: 90vw; }
.toast.err { background: var(--danger); color: #fff; }
.dialog-box { border: 1px solid var(--line); border-radius: 10px; padding: 20px; max-width: min(92vw, 28rem); background: var(--surface); color: var(--ink); }
.dialog-box::backdrop { background: rgba(0, 0, 0, .5); }
.urlbox { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.urlbox input { flex: 1 1 16rem; font-family: var(--f-mono); font-size: .85rem; }
#live { position: absolute; left: -9999px; }

/* 担当枠 */
.slot { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.slot-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.chip.member { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); font-size: .85rem; padding: 3px 6px 3px 10px; }
.chip .x { border: none; background: none; padding: 0 6px; min-height: 28px; font-size: 1rem; color: var(--muted); }
.cands { display: flex; flex-wrap: wrap; gap: 6px; }
.cand { font-size: .85rem; padding: 5px 10px; min-height: 36px; }
.cand .mk { font-family: var(--f-mono); font-weight: 700; }
.cand.v1 .mk { color: var(--yes); } .cand.v2 .mk { color: #8a5d00; } .cand.v0 { opacity: .85; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cand.v2 .mk { color: var(--maybe); } }
.addslot { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; }
.bar { height: 8px; border-radius: 4px; background: var(--off); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.bar span.w0 { width: 0; } .bar span.w10 { width: 10%; } .bar span.w20 { width: 20%; } .bar span.w30 { width: 30%; } .bar span.w40 { width: 40%; }
.bar span.w50 { width: 50%; } .bar span.w60 { width: 60%; } .bar span.w70 { width: 70%; } .bar span.w80 { width: 80%; } .bar span.w90 { width: 90%; } .bar span.w100 { width: 100%; }
.setting { flex-direction: row; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
