/* 統合アプリの共通画面(ログイン・メニューなど)の見た目。勤怠アプリの作りをもとに、色だけ落ち着いた青にした。外部の部品は使わない */
:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #2b3440;
  --muted: #5f6b7a;
  --line: #e1e6ed;
  --primary: #2f5d8a;        /* 白い文字をのせても読める濃さ */
  --primary-hover: #244a6f;
  --primary-text: #ffffff;
  --primary-soft: #e6eef7;
  --primary-ring: #b9cfe6;
  --danger: #a8321f;
  --warn-bg: #fdebd8;
  --warn-line: #f0c58f;
  --warn-text: #7a4a12;
  --ok-bg: #e4f1ea;
  --ok-line: #9fcfb4;
  --ok-text: #1f5a43;
  --err-bg: #fbe3e1;
  --head-bg: #eef2f7;
  --sat-bg: #e6effa;
  --sat-text: #245a9c;
  --sun-bg: #fce3e0;
  --sun-text: #a8321f;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(47, 93, 138, .08);}

* { box-sizing: border-box; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

body {
  margin: 0;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }

/* 上の帯 */
header { background: var(--bg); }
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 16px 4px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { font-weight: bold; font-size: 18px; color: var(--primary); text-decoration: none; letter-spacing: .5px;
         display: inline-flex; align-items: center; gap: 6px; }
.brand-icon { width: 26px; height: 26px; flex: none; }
.hero-icon { display: block; width: 72px; height: 72px; margin: 4px auto 6px; }
.login-box h1 { text-align: center; }
.who { margin-left: auto; position: relative; }
.who summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
}
.who summary::-webkit-details-marker { display: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  border: 2px solid var(--primary-ring);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 14px;
}
.who-name { max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .who-name { display: none; } }
.who-menu {
  position: absolute; right: 0; top: 44px; z-index: 10;
  min-width: 230px; padding: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 8px 24px rgba(74, 59, 54, .12);
}
.who-menu .who-detail { font-size: 13px; color: var(--muted); padding: 4px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.who-menu a, .who-menu button {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 10px;
  font: inherit; font-size: 15px; color: var(--text); text-decoration: none;
  background: none; border: none; cursor: pointer;
}
.who-menu a:hover, .who-menu button:hover { background: var(--primary-soft); }
.who-menu form { margin: 0; }

/* メニュー(丸いタブ。スマホでは横に動かして見る) */
nav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav ul {
  max-width: 960px;
  margin: 0 auto;
  padding: 6px 16px 8px;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  white-space: nowrap;
}
/* スマホでは1行に並べて横に動かす */
@media (max-width: 640px) { nav ul { flex-wrap: nowrap; } }
nav a {
  display: block;
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  font-size: 15px;
  background: var(--card);
  border: 1px solid var(--line);
}
nav a:hover { border-color: var(--primary-ring); color: var(--text); }
nav a.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); font-weight: bold; }
nav a.active .badge { background: #fff; color: var(--primary); }

.badge {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  text-align: center;
  line-height: 20px;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 16px 32px;
}

h1 { font-size: 22px; margin: 8px 0 16px; }
h2 { font-size: 18px; margin: 28px 0 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { text-align: center; }
.stat .num { font-size: 28px; font-weight: bold; color: var(--primary); }
.stat .label { color: var(--muted); font-size: 13px; }

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: 14px; margin-bottom: 8px; border: 1px solid; }
.messages .success { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-text); }
.messages .warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-text); }
.messages .error { background: var(--err-bg); border-color: var(--danger); color: var(--danger); }

.note { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text); border-radius: 14px; padding: 10px 14px; }
.muted { color: var(--muted); font-size: 14px; }

/* 表。スマホでは1件ずつのカードにする */
table.list { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
table.list th, table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list tr:last-child td { border-bottom: none; }
table.list th { background: var(--head-bg); font-size: 14px; color: var(--muted); }
@media (max-width: 640px) {
  table.list { background: none; border: none; border-radius: 0; }
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 10px; padding: 8px 0; box-shadow: var(--shadow); }
  table.list td { border: none; padding: 2px 14px; }
  table.list td[data-label]::before { content: attr(data-label) ":"; color: var(--muted); font-size: 13px; margin-right: 6px; }
}

.status { display: inline-block; padding: 0 10px; border-radius: 999px; font-size: 13px; border: 1px solid var(--line); background: #fff; }
.status-pending { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-text); }
.status-approved { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-text); }
.status-returned, .status-rejected { background: var(--err-bg); border-color: #e9a59b; color: var(--danger); }
.status-withdrawn, .status-cancelled { background: #f3eeeb; color: var(--muted); }

/* 入力欄 */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: bold; margin-bottom: 4px; }
.field input[type=text], .field input[type=password], .field input[type=email], .field input[type=number],
.field input[type=date], .field input[type=time],
.field select, .field textarea, .filters input, .filters select {
  width: 100%; max-width: 420px; padding: 10px 14px; font-size: 16px; font-family: inherit; color: var(--text);
  border: 1px solid #e6d3c9; border-radius: 12px; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus, .filters input:focus, .filters select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.field textarea { max-width: 100%; }
.field label.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.field label.check input { width: 20px; height: 20px; margin: 0; }
.field .help { color: var(--muted); font-size: 13px; margin-top: 2px; }
.field .errorlist, .errorlist { color: var(--danger); list-style: none; padding: 0; margin: 4px 0; }
.field ul.radio, .field div[id] > div { margin: 0; }
.radios label { display: inline-flex; align-items: center; gap: 4px; font-weight: normal; margin-right: 16px; }
input[type=radio], input[type=checkbox] { accent-color: var(--primary); }

.btn {
  display: inline-block; padding: 10px 22px; font-size: 16px; font-family: inherit; font-weight: bold;
  border-radius: 999px; border: 1px solid var(--primary); background: var(--primary); color: var(--primary-text);
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-text); }
.btn.secondary { background: #fff; color: var(--primary); border-color: var(--primary-ring); }
.btn.secondary:hover { background: var(--primary-soft); }
.btn.danger { background: #fff; color: var(--danger); border-color: #e9a59b; }
.btn.danger:hover { background: var(--err-bg); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.type-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.type-list a { text-align: center; padding: 16px; border-radius: 16px; }

dl.info { display: grid; grid-template-columns: 9em 1fr; gap: 6px 12px; margin: 0; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; white-space: pre-wrap; }
@media (max-width: 640px) { dl.info { grid-template-columns: 1fr; } dl.info dd { margin-bottom: 6px; } }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 3px solid var(--primary-ring); border-radius: 0; padding: 4px 0 12px 14px; }
.timeline .when { color: var(--muted); font-size: 13px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.filters label { font-size: 13px; color: var(--muted); display: block; }
.filters input, .filters select { width: auto; }

.unread { font-weight: bold; }
.pager { margin: 12px 0; display: flex; gap: 12px; }

.login-box { max-width: 400px; margin: 40px auto; }

/* 承認・差し戻し・却下 */
.decide-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 560px; }
@media (max-width: 480px) { .decide-buttons { grid-template-columns: 1fr; } }
.decide-buttons .btn { padding: 14px 8px; text-align: center; }
.btn-return { background: #fff; color: var(--warn-text); border-color: var(--warn-line); }
.btn-return:hover { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-line); }
.btn-reject { background: #fff; color: var(--danger); border-color: #e9a59b; }
.btn-reject:hover { background: var(--err-bg); color: var(--danger); border-color: #e9a59b; }
.decide-help { padding-left: 18px; margin: 10px 0 0; }

/* 2段階ログイン・利用者 */
/* QRコードは元の大きさ(1マス5ピクセル)で出す。狭い画面では全体を縮める(viewBox があるので切れない)。
   R8.11.19 まで 200px に固定していて、右と下が切れて読み取れなかった */
.qr svg { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; background: #fff;
          shape-rendering: crispEdges; }
code.secret { font-size: 17px; letter-spacing: 1px; background: var(--head-bg); padding: 2px 8px; border-radius: 8px; word-break: break-all; }
ul.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
ul.codes code { font-size: 17px; letter-spacing: 1px; }
td.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
td.row-actions .btn { padding: 6px 12px; font-size: 14px; }
@media print { header, nav, .actions { display: none; } body { background: #fff; } .card { box-shadow: none; } }

/* 出勤簿の出力 */
.export-form fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px 10px; margin: 0 0 12px; }
.export-form legend { font-weight: bold; padding: 0 4px; }
.export-form label { display: block; padding: 4px 0; }
.export-company { margin: 6px 0 0 24px; }

/* 打刻(ホーム) */
.punch { text-align: center; padding-top: 14px; }
.greeting { color: var(--muted); font-size: 14px; margin: 0; }
.clock-ring {
  width: 200px; height: 200px; margin: 10px auto 14px;
  border-radius: 50%; border: 8px solid var(--primary-ring); background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.clock-ring.state-working { border-color: #f0a483; }
.clock-ring.state-break { border-color: var(--warn-line); }
.clock-date { font-size: 13px; color: var(--muted); }
.clock { font-size: 36px; font-weight: bold; color: var(--primary); font-variant-numeric: tabular-nums; letter-spacing: 1px; line-height: 1.2; }
.punch-state { display: inline-block; margin-top: 2px; padding: 0 12px; border-radius: 999px; background: #f3eeeb; color: var(--muted); font-size: 13px; font-weight: bold; }
.punch-state.state-working { background: var(--ok-bg); color: var(--ok-text); }
.punch-state.state-break { background: var(--warn-bg); color: var(--warn-text); }
.punch .note { text-align: left; }
.punch-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px auto 8px; max-width: 640px; }
@media (max-width: 640px) { .punch-buttons { grid-template-columns: repeat(2, 1fr); } }
.punch-buttons.two { grid-template-columns: repeat(2, 1fr); max-width: 420px; }
.pbtn {
  padding: 16px 8px; font-size: 18px; font-weight: bold; font-family: inherit; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--primary); background: var(--primary); color: #fff;
}
.pbtn:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.pbtn-break { background: #fff; color: var(--primary); border-color: var(--primary-ring); }
.pbtn-break:hover { background: var(--primary-soft); border-color: var(--primary-ring); }
.pbtn-out { background: #7a4a3a; border-color: #7a4a3a; }
.pbtn-out:hover { background: #643b2e; border-color: #643b2e; }
.pbtn:disabled, .pbtn:disabled:hover { background: #f3e9e4; border-color: #f3e9e4; color: #a8958c; cursor: not-allowed; }
.punch-undo { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; margin: 4px auto 6px; }
.punch-undo .undo-left { font-size: 13px; }
.punch-today { margin: 6px 0 0; }
.punch-link { margin: 8px 0 0; font-size: 15px; }

/* ホームの数字(丸いチップ) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chip {
  flex: 1 1 140px; display: flex; flex-direction: column; align-items: center;
  padding: 10px 12px; border-radius: 20px; text-decoration: none; border: 1px solid transparent;
}
.chip:hover { border-color: currentColor; }
.chip .num { font-size: 22px; font-weight: bold; line-height: 1.3; }
.chip .label { font-size: 12px; }
.chip-leave { background: var(--warn-bg); color: var(--warn-text); }
.chip-leave:hover { color: var(--warn-text); }
.chip-approve { background: var(--ok-bg); color: var(--ok-text); }
.chip-approve:hover { color: var(--ok-text); }
.chip-notice { background: var(--primary-soft); color: var(--primary-hover); }
.chip-notice:hover { color: var(--primary-hover); }
.apply-cta { text-align: center; margin: 0 0 8px; }
.apply-cta .btn { padding: 12px 36px; }

/* 出勤簿 */
.month-nav { justify-content: space-between; margin: 4px 0 12px; }
.sheet-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
table.sheet { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 860px; }
table.sheet th, table.sheet td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.sheet th { background: var(--head-bg); color: var(--muted); position: sticky; top: 0; }
table.sheet td.apps { white-space: normal; min-width: 160px; }
table.sheet td.apps .status { margin: 1px 2px 1px 0; text-decoration: none; }
table.sheet td.ops a { margin-right: 8px; }
table.sheet td.note-cell { min-width: 180px; white-space: normal; }
table.sheet td.note-cell input {
  width: 100%; min-width: 170px; padding: 5px 10px; font: inherit; font-size: 14px; color: var(--text);
  border: 1px solid #e6d3c9; border-radius: 10px; background: #fff;
}
table.sheet td.note-cell input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
/* 土曜は青、日曜・祝日は赤。行の色は曜日で決め、打刻漏れなどの注意は左の赤い線と赤い文字で出す */
table.sheet tr.day-sat td { background: var(--sat-bg); }
table.sheet tr.day-sat td.day { color: var(--sat-text); font-weight: bold; }
table.sheet tr.day-sun td, table.sheet tr.day-hol td { background: var(--sun-bg); }
table.sheet tr.day-sun td.day, table.sheet tr.day-hol td.day { color: var(--sun-text); font-weight: bold; }
table.sheet tr.warn td.day { box-shadow: inset 5px 0 0 var(--danger); }
table.sheet tr.day-sat td.note-cell input { border-color: #c5d6ec; }
table.sheet tr.day-sun td.note-cell input, table.sheet tr.day-hol td.note-cell input { border-color: #efc4be; }
.sheet-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.sheet-legend .lg { display: inline-block; width: 16px; height: 14px; border-radius: 4px; border: 1px solid var(--line); margin-left: 8px; }
.sheet-legend .lg:first-child { margin-left: 0; }
.sheet-legend .lg-sat { background: var(--sat-bg); border-color: #c5d6ec; }
.sheet-legend .lg-sun { background: var(--sun-bg); border-color: #efc4be; }
.sheet-legend .lg-warn { background: var(--card); box-shadow: inset 5px 0 0 var(--danger); border-radius: 0; }
.hol-name { display: block; font-size: 11px; font-weight: normal; line-height: 1.2; }
.warn-text { color: var(--danger); font-size: 13px; }
.unapproved-text { color: var(--warn-text); font-size: 12px; }
.ok-text { color: var(--ok-text); background: var(--ok-bg); border-radius: 14px; padding: 8px 14px; }
table.sheet td.plan { font-size: 12px; color: var(--muted); white-space: normal; min-width: 110px; }

/* シフト表 */
table.shift-grid th, table.shift-grid td { padding: 4px 3px; text-align: center; font-size: 13px; }
table.shift-grid th.day-sat { background: var(--sat-bg); color: var(--sat-text); }
table.shift-grid th.day-sun, table.shift-grid th.day-hol { background: var(--sun-bg); color: var(--sun-text); }
table.shift-grid .who { position: sticky; left: 0; background: var(--card); text-align: left; min-width: 90px; white-space: normal; z-index: 1; }
table.shift-grid thead .who { background: var(--head-bg); z-index: 2; }
table.shift-grid select { font-size: 12px; padding: 2px 0; min-width: 52px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
table.shift-grid select.rest { background: #f3eeeb; color: var(--muted); }
table.shift-grid select.empty { border-color: var(--warn-line); background: var(--warn-bg); }
/* フレックスタイム制の集計 */
.flex-box p { margin: 4px 0 8px; }
table.flex-table { border-collapse: collapse; width: 100%; margin-bottom: 6px; }
table.flex-table th, table.flex-table td { border: 1px solid var(--line); padding: 5px 8px; font-size: 14px; }
table.flex-table th { background: var(--head-bg); font-weight: normal; text-align: left; width: 32%; }
table.flex-table td { text-align: right; white-space: nowrap; width: 18%; }
@media (max-width: 640px) {
  table.flex-table, table.flex-table tbody, table.flex-table tr { display: block; }
  table.flex-table th, table.flex-table td { display: inline-block; width: 50%; box-sizing: border-box; }
}
.link-btn { background: none; border: none; padding: 0; color: var(--primary); text-decoration: underline; font-size: 12px; cursor: pointer; }

/* ---- メニュー(使えるアプリのボタン) ---- */
.app-grid { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px;
            grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
            grid-auto-rows: 1fr; }   /* どの行も同じ高さ(いちばん高いボタンに合わせる) */
.app-grid li { display: flex; }   /* ボタンを枠いっぱいに広げ、幅・高さをそろえる */
.app-tile { flex: 1; display: flex; gap: 14px; align-items: center; padding: 18px; background: var(--card);
            border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
            color: var(--text); text-decoration: none; min-height: 96px; box-sizing: border-box; }
.app-tile:hover { border-color: var(--primary-ring); background: var(--primary-soft); color: var(--text); }
.app-tile img { width: 52px; height: 52px; flex: none; }
.app-tile .app-name { font-weight: bold; font-size: 18px; color: var(--primary); display: block; }
.app-tile .app-desc { font-size: 13px; color: var(--muted); display: block; line-height: 1.5; }
/* アプリのボタンの一言(給与明細・書類の「新しい書類 2件」など) */
.app-tile .app-badge { display: inline-block; margin-top: 6px; font-size: 12.5px; font-weight: bold; line-height: 1.7;
                       padding: 0 10px; border-radius: 999px; background: var(--primary); color: #fff; }
.menu-hello { color: var(--muted); margin: 0; }