:root{--ink:#222;--muted:#666;--line:#ccc;--bg:#f6f7f9;--card:#fff;--accent:#2563a8}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font-family:system-ui,-apple-system,"Hiragino Sans","Yu Gothic UI",Meiryo,sans-serif;line-height:1.7}
main{max-width:1200px;margin:0 auto;padding:16px}
main.doc{max-width:760px}
h1{font-size:1.6rem;line-height:1.35;margin:.4em 0}
h2{font-size:1.2rem;margin-top:1.8em}
a{color:#2b5d8f}
.small{font-size:.85rem;color:var(--muted)}
.pr-notice{font-size:.8rem;color:var(--muted);margin:0}
.tool{display:grid;grid-template-columns:320px minmax(0,1fr);gap:20px;align-items:start}
form{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:14px;min-width:0}
fieldset{border:0;margin:0 0 12px;padding:0;min-width:0}
.t{display:block;font-weight:700;font-size:.92rem;margin-bottom:4px}
select,input,textarea{font:inherit;font-size:1rem;padding:7px;border:1px solid #bbb;border-radius:6px;background:#fff;color:var(--ink);max-width:100%}
#title,#ym,#start,#names,#need{width:100%}
#names{min-height:9em}
.ty{display:grid;grid-template-columns:2.6em 1fr 4.2em 4.6em 2em;gap:4px;margin-bottom:4px}
.ty input,.ty select{width:100%;padding:5px;font-size:.9rem}
.ty .code{text-align:center;font-weight:700}
.ty .del,.btns button,#addtype{font:inherit;font-size:.9rem;padding:6px 10px;border:1px solid #bbb;border-radius:6px;background:#fff;cursor:pointer}
.ty .del{padding:0}
.tyh{display:grid;grid-template-columns:2.6em 1fr 4.2em 4.6em 2em;gap:4px;font-size:.75rem;color:var(--muted)}
.btns{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0}
#print{width:100%;font-size:1.05rem;font-weight:700;padding:12px;border:0;border-radius:8px;background:var(--accent);color:#fff;cursor:pointer}
.preview{min-width:0}
#palette{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 8px;position:sticky;top:0;background:var(--bg);padding:6px 0;z-index:2}
#palette button{font:inherit;font-weight:700;min-width:3em;padding:4px 10px;border:1px solid #999;border-radius:8px;cursor:pointer;background:#fff;line-height:1.2}
#palette button small{display:block;font-weight:400;font-size:.68rem;color:#444}
#palette button[aria-pressed=true]{outline:3px solid var(--accent);outline-offset:1px}
.wrap{overflow-x:auto;background:#fff;border:1px solid var(--line);border-radius:8px}
#grid{border-collapse:collapse;font-size:.85rem;user-select:none;-webkit-user-select:none}
#grid caption{caption-side:top;text-align:left;font-weight:800;font-size:1.05rem;padding:6px 8px}
#grid caption span{font-weight:400;font-size:.85rem;margin-left:1em;color:var(--muted)}
#grid th,#grid td{border:1px solid #9aa3ad;text-align:center;padding:0;min-width:1.9em;height:1.9em;line-height:1.15}
#grid thead th{font-weight:600;font-size:.75rem;padding:2px 0}
#grid thead th i{font-style:normal;font-size:.65rem;display:block;color:var(--muted)}
#grid thead th b{display:block;font-size:.6rem;color:#c0262d}
#grid th.nm{position:sticky;left:0;background:#fff;z-index:1;min-width:5.5em;max-width:8em;text-align:left;padding:0 4px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#grid td[data-k]{cursor:pointer;font-weight:700}
#grid .sun{color:#c0262d}#grid .sat{color:#1d4ed8}
#grid thead .sun,#grid thead .sat{background:#f3f4f6}
#grid td.sum,#grid th.sum{background:#f3f4f6;min-width:2.6em;font-weight:700;color:var(--ink)}
#grid tfoot td,#grid tfoot th{font-size:.78rem;background:#fafafa;color:var(--ink)}
#grid tfoot .total td,#grid tfoot .total th{font-weight:800}
#grid td.short{color:#fff;background:#c0262d}
#grid .empty{padding:24px;color:var(--muted);text-align:center}
#legend{display:flex;flex-wrap:wrap;gap:4px 14px;font-size:.85rem;margin:8px 0}
#legend b{display:inline-block;min-width:1.6em;text-align:center;border:1px solid #999;margin-right:4px}
.pr ul{padding-left:1.2em}.pr-label{font-size:.8rem;color:var(--muted);margin-bottom:0}
.lead{margin-top:0}
footer{border-top:1px solid var(--line);padding:16px;text-align:center;color:var(--muted);font-size:.85rem}
footer a{margin:0 8px}
table.doc{border-collapse:collapse;width:100%;font-size:.92rem}
table.doc th,table.doc td{border:1px solid var(--line);padding:6px 8px;text-align:left}
@media (max-width:820px){.tool{grid-template-columns:1fr}}
@media print{
 @page{size:A4 landscape;margin:8mm}
 body{background:#fff}
 body>*:not(main),main>*:not(.tool),.tool>form{display:none!important}
 main{padding:0;max-width:none}.tool{display:block}
 #palette,#info,.no-print{display:none!important}
 .wrap{overflow:visible;border:0}
 #grid{width:100%;table-layout:fixed;font-size:calc(min(9pt, 230mm / var(--cols) * .55))}
 #grid th,#grid td{min-width:0;height:6.2mm}
 #grid th.nm{width:24mm;position:static}
 #grid .sum{width:10mm}
 #grid td,#grid th{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}
