:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1c2430;
  --sub: #5d6878;
  --line: #e1e6ee;
  --blue: #1f6feb;
  --blue-dark: #1758c2;
  --orange: #e8590c;
  --orange-dark: #c24a08;
  --green: #2f9e44;
  --green-dark: #237a34;
  --gray: #868e96;
  --warn-bg: #fff4e6;
  --warn: #b35900;
  --err-bg: #ffe3e3;
  --err: #c92a2a;
  --ok-bg: #ebfbee;
  --radius: 16px;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; -webkit-text-size-adjust: 100%; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
a { color: var(--blue); }
.hidden { display: none !important; }
.muted { color: var(--sub); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- スタッフ打刻画面 ---------- */
.staff { max-width: 480px; margin: 0 auto; padding: 20px 16px 48px; }
.staff-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.staff-brand { font-size: 13px; color: var(--sub); letter-spacing: .05em; }
.staff-name { font-size: 22px; font-weight: 700; margin: 4px 0 0; }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; background: #e9ecef; color: var(--sub); white-space: nowrap; }
.badge.working { background: #e7f0ff; color: var(--blue-dark); }
.badge.break { background: #e6f7ea; color: var(--green-dark); }
.clock { text-align: center; margin: 20px 0 8px; }
.clock-date { font-size: 16px; color: var(--sub); }
.clock-time { font-size: 64px; font-weight: 700; letter-spacing: .02em; line-height: 1.1; }
.punch-main { display: block; width: 100%; border: 0; border-radius: 24px; color: #fff; font-size: 40px; font-weight: 800; padding: 40px 0; margin-top: 16px; box-shadow: 0 6px 0 rgba(0,0,0,.18); transition: transform .05s, box-shadow .05s; letter-spacing: .1em; }
.punch-main:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.punch-main:disabled { opacity: .6; }
.punch-main.in { background: var(--blue); }
.punch-main.out { background: var(--orange); }
.punch-main.breakEnd { background: var(--green); }
.punch-sub { display: block; width: 100%; margin-top: 12px; padding: 18px 0; border-radius: 16px; border: 2px solid var(--line); background: var(--card); font-size: 20px; font-weight: 700; color: var(--text); }
.punch-sub:active { background: #f1f3f5; }
.notice { border-radius: 12px; padding: 12px 14px; margin-top: 16px; font-size: 15px; line-height: 1.6; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.err { background: var(--err-bg); color: var(--err); }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-top: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card h2 { font-size: 16px; margin: 0 0 10px; }
.today-list { list-style: none; padding: 0; margin: 0; }
.today-list li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 17px; }
.today-list li:last-child { border-bottom: 0; }
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.month-nav button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 12px; }
.mtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.mtable th, .mtable td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.mtable th { color: var(--sub); font-weight: 600; font-size: 12px; }
.mtable td.issue { color: var(--err); font-weight: 700; }
.total { display: flex; justify-content: space-between; font-weight: 700; padding-top: 10px; }
details.card summary { font-weight: 700; cursor: pointer; }
.form-row { margin-top: 10px; }
.form-row label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 4px; }
.form-row input, .form-row textarea, .form-row select { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.btn { border: 0; border-radius: 10px; padding: 10px 16px; background: var(--blue); color: #fff; font-weight: 700; }
.btn.secondary { background: #e9ecef; color: var(--text); }
.btn.danger { background: var(--err); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; }
.hint { font-size: 13px; color: var(--sub); line-height: 1.7; margin-top: 24px; text-align: center; }

/* 打刻完了の全画面表示 */
.done-overlay { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; z-index: 50; text-align: center; padding: 24px; animation: pop .2s ease-out; }
.done-overlay.in { background: var(--blue); }
.done-overlay.out { background: var(--orange); }
.done-overlay.breakStart, .done-overlay.breakEnd { background: var(--green); }
.done-check { width: 96px; height: 96px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 56px; }
.done-title { font-size: 34px; font-weight: 800; margin-top: 20px; }
.done-time { font-size: 72px; font-weight: 800; margin-top: 4px; }
.done-sub { font-size: 16px; opacity: .9; margin-top: 8px; }
.done-close { margin-top: 32px; background: rgba(255,255,255,.2); color: #fff; border: 2px solid rgba(255,255,255,.6); border-radius: 999px; padding: 12px 32px; font-size: 18px; font-weight: 700; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

.center-msg { max-width: 420px; margin: 80px auto; text-align: center; padding: 0 16px; line-height: 1.8; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 管理画面 ---------- */
.admin-top { background: #1c2430; color: #fff; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-top .title { font-weight: 800; letter-spacing: .05em; }
.admin-top .who { font-size: 13px; opacity: .8; }
.admin-top button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; padding: 4px 10px; font-size: 13px; }
.tabs { display: flex; gap: 4px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 14px 14px 12px; font-weight: 700; color: var(--sub); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }
.tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--err); color: #fff; font-size: 12px; margin-left: 4px; }
.admin-main { max-width: 1400px; margin: 0 auto; padding: 20px 16px 60px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select, .toolbar input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.toolbar .spacer { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.scard { background: #fff; border-radius: 12px; padding: 14px; border: 1px solid var(--line); }
.scard .name { font-weight: 700; font-size: 16px; }
.scard .meta { font-size: 13px; color: var(--sub); margin-top: 6px; }
.scard.alert { border-color: var(--err); background: #fff8f8; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.data th { background: #f8f9fb; font-size: 12px; color: var(--sub); font-weight: 700; position: sticky; top: 0; }
table.data td.r, table.data th.r { text-align: right; }
table.data tr.issue td { background: #fff5f5; }
table.data tr.sub td { background: #fafbfc; font-size: 13px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; background: #e9ecef; color: var(--sub); margin-right: 4px; }
.tag.err { background: var(--err-bg); color: var(--err); }
.tag.edit { background: #fff3bf; color: #8a6d00; }
.tag.admin { background: #e7f0ff; color: var(--blue-dark); }
.url-box { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: #f1f3f5; padding: 4px 8px; border-radius: 6px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 16px; }
.modal { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 12px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1c2430; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 60; font-size: 14px; }
.login-box { max-width: 380px; margin: 100px auto; background: #fff; padding: 32px 24px; border-radius: 16px; text-align: center; }
.login-box h1 { font-size: 20px; }
.empty { padding: 30px; text-align: center; color: var(--sub); }

/* ---------- 追加機能 ---------- */
.clock-sub { font-size: 15px; color: var(--sub); margin-top: 4px; min-height: 1.4em; }
.clock-sub strong { color: var(--text); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.card-head h2 { margin: 0; }
.worktime { font-size: 14px; color: var(--sub); }
.worktime strong { font-size: 20px; color: var(--text); margin-left: 4px; }
.card textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; }
.row-end { display: flex; justify-content: flex-end; margin-top: 8px; }
.sub-h { font-size: 14px; margin: 16px 0 6px; color: var(--sub); }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row.seg { display: flex; gap: 16px; }
.form-row.seg label { display: flex; align-items: center; gap: 6px; font-size: 16px; color: var(--text); margin: 0; }
.form-row.seg input { width: auto; }
.check-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.check-list label { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 15px; color: var(--text); margin: 0; background: #fff; }
.check-list label.on { border-color: var(--blue); background: #eef4ff; }
.check-list input { width: 20px; height: 20px; margin: 0; }
.today-list li .x { border: 0; background: none; color: var(--sub); font-size: 13px; padding: 0 0 0 8px; text-decoration: underline; }
.st-open { color: var(--sub); } .st-approved { color: var(--green-dark); font-weight: 700; } .st-rejected { color: var(--err); font-weight: 700; }
.toast.hidden { display: none; }
.tag.late { background: #fff3bf; color: #8a6d00; }
.tag.leave { background: #e6f7ea; color: var(--green-dark); }
.tag.memo { background: #e7f0ff; color: var(--blue-dark); }
.memo-cell { white-space: normal !important; max-width: 260px; font-size: 13px; color: var(--sub); }
/* シフト表 */
.shift-grid { border-collapse: collapse; font-size: 12px; }
.shift-grid th, .shift-grid td { border: 1px solid var(--line); padding: 0; text-align: center; min-width: 42px; height: 44px; }
.shift-grid th { background: #f8f9fb; color: var(--sub); font-weight: 700; padding: 4px; position: sticky; top: 0; }
.shift-grid th.name, .shift-grid td.name { position: sticky; left: 0; background: #fff; min-width: 96px; text-align: left; padding: 4px 8px; font-size: 13px; font-weight: 700; z-index: 1; }
.shift-grid th.sat { color: var(--blue); } .shift-grid th.sun { color: var(--err); }
.shift-grid td.cell { cursor: pointer; line-height: 1.25; }
.shift-grid td.cell:hover { background: #f1f5ff; }
.shift-grid .s { display: block; font-weight: 700; color: var(--text); }
.shift-grid .s.draft { color: var(--orange-dark); }
.shift-grid .w { display: block; color: var(--green-dark); font-size: 11px; }
.shift-grid .w.no { color: var(--err); }
.shift-grid .lv { display: block; color: var(--green-dark); font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--sub); margin: 8px 0; }
.stat-row { display: flex; gap: 20px; flex-wrap: wrap; }

/* PC教室：コマごとの出欠表 */
.att-grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.att-grid th, .att-grid td { border-bottom: 1px solid var(--line); padding: 6px 2px; text-align: center; }
.att-grid th { font-size: 11px; color: var(--sub); font-weight: 700; line-height: 1.3; }
.att-grid th button { border: 0; background: none; color: var(--blue); font: inherit; font-size: 11px; padding: 2px 0 0; text-decoration: underline; }
.att-grid td.nm { text-align: left; font-weight: 700; padding-left: 4px; }
.att-grid input { width: 26px; height: 26px; margin: 0; accent-color: var(--blue); }
.att-grid td.cnt { font-size: 12px; color: var(--sub); }
.att-grid tfoot td { font-size: 12px; color: var(--sub); border-bottom: 0; }

/* 名簿の編集（講師） */
.roster-box { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fafbfc; }
.roster-box summary { font-weight: 700; font-size: 14px; cursor: pointer; }
.roster-add { display: flex; gap: 8px; margin-top: 10px; }
.roster-add .btn { white-space: nowrap; flex-shrink: 0; }
.roster-add input { flex: 1; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.roster-box li .x { color: var(--err); }

/* 勤務先（事業所） */
.site-pick { margin-top: 14px; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; }
.site-pick .lbl { font-size: 13px; color: var(--sub); white-space: nowrap; }
.site-pick select { flex: 1; min-width: 0; font-size: 18px; font-weight: 700; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.site-pick .val { font-size: 18px; font-weight: 700; }
.site-pick.need { border-color: var(--orange); }
