/* VOICE: 業務SaaSの実直さ。迷わない、読み違えない
   IDEA: 一般的な勤怠管理サービス（ホームは打刻機、タイムカードは帳票）
   PICTURE: 1画面に収まる打刻台：大きな時計、名前ボタン、青の打刻ボタン4つ
   COLOUR and TYPE: コーポレートブルー #2f6fb5／薄グレー地／白カード。Noto Sans JP
   LAYOUT: 青ヘッダーにタブ。各画面は画面の高さに収め、はみ出す分は枠の中でだけスクロール */
:root{color-scheme:light dark;--blue:light-dark(#2f6fb5,#4d8fd6);--bluebg:light-dark(#eaf2fb,#18263a);--bg:light-dark(#eceef2,#121417);--card:light-dark(#ffffff,#1b1e22);--ink:light-dark(#222222,#e9ebee);--sub:light-dark(#62666c,#a2a8b0);--line:light-dark(#cfd3d8,#353a41);--soft:light-dark(#f2f3f5,#24282d);--red:light-dark(#c8352b,#ff6f63);--pink:light-dark(#ffc4cd,#4a2027);--yel:light-dark(#fff1bf,#3d3417);--th:light-dark(#dfe2e6,#2a2e34);--green:#2e9e5b;--amber:#e0a100;--hh:52px}
:root[data-theme=light]{color-scheme:light}:root[data-theme=dark]{color-scheme:dark}
*{box-sizing:border-box;min-width:0}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.5 "Noto Sans JP",system-ui,sans-serif;overflow-x:clip;-webkit-font-smoothing:antialiased;display:flex;flex-direction:column;min-height:100dvh}
.n{font-variant-numeric:tabular-nums;white-space:nowrap}
button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation}
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #f2b705;outline-offset:2px}
[hidden]{display:none!important}
svg.i{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}

/* ヘッダー＋タブ */
.top{background:var(--blue);color:#fff;min-height:var(--hh);display:flex;align-items:stretch;gap:8px 20px;padding:0 max(1.6vw,12px);flex-wrap:wrap;flex:none}
.brand{font-size:18px;font-weight:700;letter-spacing:.04em;display:flex;align-items:center;gap:10px;white-space:nowrap}
.brand small{font-weight:500;font-size:13px;opacity:.9;letter-spacing:0}
.tabs{display:flex;gap:2px;align-items:stretch;flex:1;overflow-x:auto}
.tab{flex:none;display:flex;align-items:center;gap:6px;border:0;background:none;padding:0 16px;font-weight:500;font-size:15px;color:rgba(255,255,255,.82);border-bottom:3px solid transparent;border-top:3px solid transparent;min-height:var(--hh)}
.tab:hover{color:#fff;background:rgba(255,255,255,.08)}
.tab[aria-selected=true]{color:#fff;border-bottom-color:#fff;font-weight:700;background:rgba(255,255,255,.12)}
.tab .lk{width:13px;height:13px;opacity:.75}
.adm{display:flex;align-items:center;gap:8px;font-size:13px;white-space:nowrap;margin-left:auto}
.adm button{background:rgba(255,255,255,.16);border:1px solid rgba(255,255,255,.55);color:#fff;border-radius:4px;min-height:34px;padding:0 12px;font-size:13px}
.demo{background:light-dark(#fff6d6,#3a3215);font-size:12px;padding:4px max(1.6vw,12px);display:flex;gap:8px;align-items:center;flex:none}
.demo b{color:var(--red)}
main{flex:1;display:flex;flex-direction:column;padding:14px max(1.6vw,12px);min-height:0}
.card{background:var(--card);border-radius:6px;padding:clamp(14px,2vw,26px)}
.lnk{color:var(--blue);font-size:13px;font-weight:500;background:none;border:0;display:inline-flex;align-items:center;gap:4px;min-height:30px;padding:0}

/* ホーム：画面の高さに収める */
.home{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(330px,440px);gap:14px}
.hl,.hr{display:flex;flex-direction:column;min-height:0;gap:12px}
.hl{padding:clamp(14px,2vw,24px)}
.date{font-size:clamp(16px,2.4vh,20px);font-weight:700}
.clock{font-size:clamp(54px,min(8.5vw,13vh),112px);font-weight:500;line-height:1;letter-spacing:-.02em}
.clock span{font-size:.42em;margin-left:.2em}
.lbl{font-size:13px;color:var(--sub);font-weight:500;display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap}
.legend{display:flex;gap:12px;font-size:12px;font-weight:400}
.legend span{display:inline-flex;align-items:center;gap:5px}.legend i{width:9px;height:9px;border-radius:50%;display:inline-block}
.staff{flex:1;min-height:90px;overflow-y:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px;align-content:start;padding:2px}
.st{display:flex;align-items:center;gap:9px;min-height:clamp(48px,7vh,60px);padding:0 14px;border:1px solid var(--line);border-radius:6px;background:var(--card);font-weight:500;font-size:clamp(15px,2.1vh,17px);text-align:left}
.st i{width:10px;height:10px;border-radius:50%;background:var(--line);flex:none}
.st i.work{background:var(--green)}.st i.break{background:var(--amber)}
.st small{margin-left:auto;font-size:12px;color:var(--sub);font-weight:400}
.st[aria-pressed=true]{background:var(--blue);border-color:var(--blue);color:#fff}
.st[aria-pressed=true] small{color:rgba(255,255,255,.85)}
.st[aria-pressed=true] i{box-shadow:0 0 0 2px #fff}
.hr .card{padding:14px 16px}
.lastp{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:13px;color:var(--sub)}
.lastp span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sbtn{border:1px solid var(--line);background:var(--card);border-radius:4px;min-height:36px;padding:0 12px;font-size:13px;font-weight:500;flex:none}
.sbtn:disabled{opacity:.4;cursor:not-allowed}
.who{font-size:18px;font-weight:700;display:flex;align-items:center;gap:10px;min-height:28px}
.who small{font-size:13px;font-weight:500;color:var(--sub)}
.who.none{color:var(--sub);font-weight:500;font-size:15px}
.pgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:10px}
.pb{display:flex;align-items:center;justify-content:center;gap:8px;height:clamp(64px,11.5vh,100px);border-radius:4px;font-size:clamp(18px,2.8vh,22px);font-weight:700;border:2px solid var(--blue);background:var(--card);color:var(--blue)}
.pb.solid{background:var(--blue);color:#fff}
.pb:not(:disabled):active{transform:scale(.98)}
.pb:disabled{border-color:var(--line);background:var(--soft);color:var(--sub);opacity:.55;cursor:not-allowed}
.pb svg.i{width:22px;height:22px;stroke-width:2.2}
.today{flex:1;min-height:0;display:flex;flex-direction:column;gap:8px}
.today h3{margin:0;font-size:14px;display:flex;justify-content:space-between;gap:8px}
.today h3 span{font-weight:400;color:var(--sub);font-size:12px}
.fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.fd{background:var(--soft);border-radius:4px;min-height:clamp(32px,4.6vh,40px);display:flex;align-items:center;padding:0 10px;gap:8px;font-size:12px;color:var(--sub)}
.fd b{margin-left:auto;color:var(--ink);font-size:15px;font-weight:700}
.fd.total{grid-column:1/-1;background:var(--bluebg)}.fd.total b{color:var(--blue);font-size:18px}
.wn{margin:0;color:var(--red);font-size:12px;font-weight:700}
.center{text-align:center;max-width:520px;margin:auto;display:grid;gap:14px;justify-items:center}
.center h2{margin:0;font-size:20px}.center p{margin:0;color:var(--sub)}

/* タイムカード：左にスタッフ、右に帳票。帳票は枠の中だけスクロール */
.tc{flex:1;min-height:0;display:grid;grid-template-columns:220px minmax(0,1fr);gap:14px}
.tside{display:flex;flex-direction:column;gap:10px;min-height:0;padding:14px}
.tside .sel{width:100%}
.slist{flex:1;min-height:0;overflow-y:auto;display:grid;gap:4px;align-content:start}
.sl{display:grid;grid-template-columns:1fr auto;align-items:center;gap:2px 8px;text-align:left;border:1px solid transparent;border-radius:4px;background:none;padding:7px 10px;min-height:44px}
.sl:hover{background:var(--soft)}
.sl[aria-pressed=true]{background:var(--bluebg);border-color:var(--blue)}
.sl b{font-weight:500;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sl span{font-size:13px;font-weight:700}
.sl small{grid-column:1/-1;font-size:11px;color:var(--sub)}
.sl small em{font-style:normal;color:var(--red);font-weight:700}
.tmain{display:flex;flex-direction:column;gap:10px;min-height:0;padding:14px 16px}
.thead{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px}
.thead h1{margin:0;font-size:19px}
.thead .rng{font-size:12px;color:var(--sub)}
.thead .acts{margin-left:auto}
.chips{display:flex;flex-wrap:wrap;gap:6px}
.chip{background:var(--soft);border-radius:4px;padding:4px 10px;font-size:12px;color:var(--sub);display:flex;align-items:baseline;gap:6px}
.chip b{font-size:16px;color:var(--ink)}
.chip.bad b{color:var(--red)}
.gw{flex:1;min-height:0;overflow:auto;border:1px solid var(--line)}
.grid{border-collapse:collapse;font-size:13px;width:100%;table-layout:fixed}
.grid th{position:sticky;top:0;z-index:1;background:var(--th);font-weight:700;font-size:12px;text-align:center;line-height:1.25;padding:6px 4px;border:1px solid var(--line)}
.grid th.mn{background:var(--blue);color:#fff}
.grid td{border:1px solid var(--line);padding:0 6px;height:32px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.grid td.r{text-align:right}
.grid td.mn{padding:0;text-align:center;background:light-dark(#f3f6fa,#1f242b)}
.grid tbody tr:hover td{background:var(--bluebg)}
.grid tr.sun td{border-bottom:2px solid light-dark(#666,#999)}
.grid .sat .dt{color:var(--blue)}.grid .sun .dt{color:var(--red)}
.grid tr.warn td{background:var(--yel)}
.grid tr.err td{background:var(--pink)}
.grid tr.today td{box-shadow:inset 0 2px 0 #d9822b,inset 0 -2px 0 #d9822b}
.grid tr.today td:first-child{box-shadow:inset 2px 2px 0 #d9822b,inset 0 -2px 0 #d9822b}
.grid tr.today td:last-child{box-shadow:inset -2px 2px 0 #d9822b,inset 0 -2px 0 #d9822b}
.grid small{color:var(--sub);font-size:11px;margin-left:4px}
.menu{border:0;background:none;width:100%;height:31px;display:grid;place-items:center;color:var(--blue)}
.menu svg.i{width:20px;height:20px;stroke-width:2.4}
.menu:hover{background:var(--bluebg)}
.wi{color:#e06a00;margin-left:4px;vertical-align:-3px}.wi svg.i{width:15px;height:15px}
.mk{display:inline-block;font-size:10px;font-weight:700;color:var(--red);margin-right:2px}
.bk{font-size:12px}
.bk .w{color:var(--red);font-weight:700;margin-right:6px}
.glg{display:flex;flex-wrap:wrap;gap:4px 14px;font-size:11px;color:var(--sub)}
.glg span{display:inline-flex;align-items:center;gap:5px}.glg i{display:inline-block;width:13px;height:9px}

/* 管理画面（履歴・設定） */
.scroll{flex:1;min-height:0;overflow:auto}
.ph{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:10px;margin-bottom:12px}
.ph h1{margin:0;font-size:20px}
.ph p{margin:2px 0 0;font-size:12px;color:var(--sub)}
.acts{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.sel,.inp{min-height:40px;padding:0 12px;border:1px solid var(--line);border-radius:4px;background:var(--card);font:inherit;font-size:15px;color:var(--ink)}
.sel{appearance:none;padding-right:32px;background:var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%23666'/%3E%3C/svg%3E") no-repeat right 11px center}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:40px;padding:0 14px;border-radius:4px;border:1px solid var(--line);background:var(--card);font-weight:500;font-size:14px;white-space:nowrap}
.btn.pri{background:var(--blue);border-color:var(--blue);color:#fff}
.btn.red{background:var(--red);border-color:var(--red);color:#fff}
.btn:disabled{opacity:.5;cursor:not-allowed}
.btn svg.i{width:16px;height:16px}
.tbl{border-collapse:collapse;width:100%;font-size:14px}
.tbl th{position:sticky;top:0;background:var(--th);font-size:12px;font-weight:700;text-align:left;padding:8px 10px;border:1px solid var(--line);white-space:nowrap}
.tbl td{padding:8px 10px;border:1px solid var(--line);vertical-align:top}
.tbl td.r,.tbl th.r{text-align:right}
.cp{display:inline-block;white-space:nowrap}.cp s{color:var(--sub)}.cp b{color:var(--red)}
.tag{display:inline-block;font-size:11px;font-weight:700;border-radius:3px;padding:0 6px;border:1px solid currentColor;white-space:nowrap}
.tag.undo{color:#b26a00}.tag.add{color:var(--blue)}.tag.edit{color:var(--red)}
.empty{text-align:center;color:var(--sub);padding:30px 12px}
.sets{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;align-content:start}
.sec{display:grid;gap:12px;align-content:start}
.sec.wide{grid-column:1/-1}
.sec h2{font-size:16px;margin:0}
.sec .note{font-size:12px;color:var(--sub);margin:0}
.frow{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px}
.f{display:grid;gap:4px;font-size:13px;color:var(--sub);font-weight:500}
.f input,.f textarea,.f select{font:inherit;font-size:16px;color:var(--ink);background:var(--card);border:1px solid var(--line);border-radius:4px;min-height:42px;padding:6px 10px;width:100%}
.ok{color:var(--green);font-weight:700}
.badge{font-size:11px;border-radius:3px;padding:1px 7px;background:var(--soft);color:var(--sub);white-space:nowrap}
.badge.on{background:light-dark(#e3f4ea,#173326);color:var(--green)}

/* 暗証番号（4桁で自動入場） */
.pin{display:grid;gap:14px;justify-items:center;margin:auto;padding:10px}
.pin h2{margin:0;font-size:18px}.pin p{margin:0;font-size:13px;color:var(--sub);text-align:center}
.dots{display:flex;gap:12px}
.dots i{width:50px;height:58px;border:2px solid var(--line);border-radius:6px;display:grid;place-items:center;font-style:normal}
.dots i.on::after{content:"";width:14px;height:14px;border-radius:50%;background:var(--ink)}
.dots i.cur{border-color:var(--blue)}
.dots.shake{animation:shake .35s}
@keyframes shake{25%{transform:translateX(-8px)}75%{transform:translateX(8px)}}
.pad{display:grid;grid-template-columns:repeat(3,76px);gap:10px}
.pad button{height:62px;border:1px solid var(--line);border-radius:6px;background:var(--card);font-size:24px;font-weight:500}
.pad button.sm{font-size:14px;color:var(--sub)}
.pad button:active{background:var(--soft)}
.pinx{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px}
.err{color:var(--red);font-size:13px;font-weight:500;margin:0;min-height:1.3em}

/* ダイアログ */
dialog{border:0;padding:0;border-radius:8px;width:min(620px,calc(100% - 24px));max-height:calc(100dvh - 24px);background:var(--card);color:var(--ink);box-shadow:0 24px 60px rgba(0,0,0,.3)}
dialog.wide{width:min(980px,calc(100% - 24px))}
dialog::backdrop{background:rgba(20,24,30,.5)}
.dh{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:14px 20px;border-bottom:1px solid var(--line)}
.dh h3{margin:0;font-size:17px}.dh p{margin:2px 0 0;font-size:12px;color:var(--sub)}
.x{border:0;background:none;width:40px;height:40px;display:grid;place-items:center;border-radius:4px;flex:none}.x:hover{background:var(--soft)}
.db{padding:14px 20px;display:grid;gap:12px;max-height:calc(100dvh - 190px);overflow:auto}
.df{display:flex;justify-content:flex-end;gap:8px;padding:12px 20px;border-top:1px solid var(--line);flex-wrap:wrap}
.g4{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.req{display:inline-block;background:var(--red);color:#fff;font-size:10px;border-radius:2px;padding:0 4px;margin-left:6px;vertical-align:1px}
.qr{display:flex;flex-wrap:wrap;gap:6px}
.qr button{border:1px solid var(--line);background:var(--soft);border-radius:4px;min-height:34px;padding:0 10px;font-size:13px}
.hist{border:1px solid var(--line);border-radius:4px;font-size:13px}
.hist div{padding:8px 12px;border-bottom:1px solid var(--line)}.hist div:last-child{border-bottom:0}
.hist em{font-style:normal;color:var(--sub)}
.res{display:grid;justify-items:center;text-align:center;gap:6px;padding:26px 22px 6px}
.res .okc{width:60px;height:60px;border-radius:50%;background:var(--blue);display:grid;place-items:center;color:#fff}
.res .okc svg.i{width:30px;height:30px;stroke-width:2.6}
.res b{font-size:19px}.res .tm{font-size:42px;font-weight:500;line-height:1.1}
.worked{width:100%;background:var(--bluebg);border-radius:6px;padding:14px;margin-top:8px;display:grid;gap:6px}
.worked span{font-size:13px;color:var(--sub)}
.worked strong{font-size:36px;color:var(--blue);line-height:1.2}
.worked strong small{font-size:14px;margin:0 3px;color:var(--sub)}
.brkd{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;font-size:12px;color:var(--sub)}
.brkd div{background:var(--card);border-radius:4px;padding:6px}.brkd b{display:block;font-size:16px;color:var(--ink)}
textarea.csv{font-family:ui-monospace,Menlo,monospace;font-size:12px;min-height:160px}
.toast{position:fixed;left:50%;bottom:24px;transform:translate(-50%,160px);background:#2b2f35;color:#fff;padding:12px 20px;border-radius:6px;font-weight:500;z-index:9;transition:transform .25s;max-width:calc(100% - 32px)}
.toast:empty{display:none}
.toast.on{transform:translate(-50%,0)}
.toast.bad{background:var(--red)}
.loading{color:var(--sub);text-align:center;padding:60px 0}
@media(prefers-reduced-motion:reduce){.toast{transition:none}.dots.shake{animation:none}}

/* 縦長タブレット・スマホ：ページ全体のスクロールを許す */
@media(max-width:900px){
  .home{grid-template-columns:minmax(0,1fr)}
  .staff{max-height:none;overflow:visible}
  .clock{font-size:min(14vw,8vh)}
  .pb{height:clamp(60px,8vh,84px)}
  .tc{grid-template-columns:minmax(0,1fr)}
  .tside .slist{display:none}
  .tside{padding:10px 12px}
  .sets{grid-template-columns:minmax(0,1fr)}
}
@media(max-width:900px),(max-height:600px){body{min-height:100dvh}main{flex:none}.home,.tc{flex:none}.gw{flex:none;max-height:none;overflow:visible}.grid th{position:static}}
@media(max-width:700px){
  .top{padding:0 10px}.brand small{display:none}.tab{padding:0 10px;font-size:14px}
  .g4{grid-template-columns:repeat(2,minmax(0,1fr))}.brkd{grid-template-columns:repeat(2,minmax(0,1fr))}
  .grid.ph thead{display:none}.grid.ph td{white-space:normal;height:auto;padding:6px}.grid.ph td.mn{padding:0}.grid.ph .pl{font-size:13px;margin-top:2px;white-space:normal;overflow-wrap:anywhere}.grid.ph td{overflow:visible}.grid.ph td.r b{font-size:15px}
  .demo{display:block}
}
