/* =====================================================================
   メッセル 勤怠 — 共通デザイン（2026-09-25 リデザイン。就労B「MESSEL for 就労B業務支援システム」準拠）
   ・トークンは kouchin-daicho public/index.html の :root と同じ値。ブランド色は差し色に限定し、
     グラデ（--grad）は主ボタン・選択中のナビ・ワードマーク・ロゴだけに使う
   ・旧トークン名（--gold / --paper / --mute / --red …）は各ページのインライン style と JS が参照しているので、
     消さずに新トークンへの別名として残している
   ・業務上の意味を持つ色（--sat / --sun の土日、--blue / --cyan の対面・オンライン）は値を変えていない
   ・末尾の @media print は旧デザインのまま（出勤簿・支払調書の印刷は変えない）
===================================================================== */
:root {
  --b1: #2f9bff; --b2: #1fc8b6;
  --grad: linear-gradient(135deg, var(--b1), var(--b2));
  --brand: #1f8ff0; --brand-ink: #1466c2; --brand-soft: #e9f4ff; --teal-soft: #e3f8f4;
  --ink: #16202c; --txt: #1e2b3c; --muted: #556678; --faint: #8794a6;
  --bg: #f3f6fa; --panel: #fff; --line: #e3e9f1; --line2: #cbd6e3;
  --side: #141d33; --side2: #1a2745; --side-txt: #b7c3d6; --side-dim: #7d8ca6;
  --ok: #158a52; --ok-soft: #e5f6ec; --ok-line: #a9dfbf;
  --warn: #b3580a; --warn-soft: #fff6e6; --warn-line: #f3cf8f;
  --bad: #c93a3a; --bad-soft: #fdeeee; --bad-line: #f0c2c2;
  --pop: #ff6f61; --r: 14px; --r-sm: 9px;
  --shadow: 0 1px 2px rgba(20,35,60,.04), 0 6px 18px -10px rgba(20,35,60,.10);
  --shadow-lg: 0 20px 60px -20px rgba(20,35,60,.35);
  --side-w: 224px; --hf-accent: #1466c2;

  /* 旧トークン名（互換の別名） */
  --accent: var(--brand-ink);
  --gold: var(--brand-ink);
  --gold-dark: var(--brand-ink);
  --gold-soft: #8ec5ff;
  --gold-pale: var(--brand-soft);
  --ink-soft: var(--txt);
  --mute: var(--muted);
  --paper: var(--bg);
  --paper-warm: #f6f9fc;
  --line-dark: var(--line2);
  --red: var(--bad);
  --green: var(--ok);
  --side-line: rgba(255,255,255,.08);
  --side-text: var(--side-txt);
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Meiryo", "Yu Gothic UI", "Yu Gothic", sans-serif;
  /* 業務色（値は変えない） */
  --sat: #1d63e8;
  --sun: #c9303f;
  --blue: #2563eb;
  --blue-pale: #eaf1fd;
  --cyan: #0ea5e9;
  --cyan-pale: #e6f6fd;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--sans); background: var(--bg); color: var(--txt); font-size: 15px; line-height: 1.6; display: flex; min-height: 100vh; }
::selection { background: rgba(47,155,255,.22); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
a { color: var(--brand-ink); }
b, strong { font-weight: 700; }

/* ===== サイドバー ===== */
.side { width: var(--side-w); min-width: var(--side-w); position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow: auto; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--side) 0%, var(--side2) 100%); color: var(--side-txt); padding: 16px 12px 12px; z-index: 45; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.side .brand { padding: 2px 8px 14px; margin-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side .lockup { display: flex; align-items: center; gap: 9px; text-decoration: none; color: #fff; }
.side .mslogo { width: 30px; height: 30px; flex: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.side .wordmark { font-family: "Montserrat", "Hiragino Sans", "Meiryo", sans-serif; font-weight: 800; letter-spacing: .06em; font-size: 21px; line-height: 1; background: linear-gradient(90deg, #2f9bff, #1fc8b6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.side .brandsub { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.side .brandsub small { font-size: 12.5px; font-weight: 700; color: #e6edf7; letter-spacing: .02em; white-space: nowrap; }
/* 社内システムの切替（assets/app-switch.js。承認されているシステムだけ並ぶ） */
.appSwitch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 0 2px 12px; margin-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.appSwitch[hidden] { display: none; }
.appSwitch a { text-align: center; font-size: 12px; font-weight: 600; padding: 5px 4px; border: 1px solid rgba(255,255,255,.10); border-radius: 7px; color: #c9d4e4; text-decoration: none; background: rgba(255,255,255,.05); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: .15s; }
.appSwitch a:hover { background: rgba(255,255,255,.12); color: #fff; }
.appSwitch a.cur { background: var(--brand); color: #fff; border-color: transparent; font-weight: 700; }
.sideNav { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.navGroup { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--side-dim); margin: 12px 10px 4px; letter-spacing: .12em; font-weight: 700; }
.navGroup svg { display: none; }
.sideNav > .navGroup:first-child { margin-top: 0; }
.sideNav a, .sideNav button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: none; background: none; padding: 8px 10px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--side-txt); cursor: pointer; text-decoration: none; font-family: inherit; line-height: 1.3; transition: background .15s, color .15s; }
.sideNav .ico { display: inline-flex; width: 18px; height: 18px; flex: none; opacity: .75; }
.sideNav .ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sideNav a:hover, .sideNav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.sideNav a:hover .ico, .sideNav button:hover .ico { opacity: 1; }
/* 月末にまとめて使う画面（支払・振込）は、探さずに見つかるよう少しだけ色を変える。
   選択中の見た目は他と同じにするので、.active のほうが後ろに来る順番を崩さないこと */
.sideNav button.accent { color: #bfe0ff; background: rgba(47,155,255,.14); font-weight: 700; }
.sideNav button.accent:hover { background: rgba(47,155,255,.26); color: #fff; }
.sideNav a.active, .sideNav button.active { background: var(--grad); color: #fff; font-weight: 700; box-shadow: 0 8px 18px -8px rgba(47,155,255,.8); }
.sideNav button.accent.active { background: var(--grad); color: #fff; }
.sideNav a.active .ico, .sideNav button.active .ico { opacity: 1; }
.sideNav .cnt { margin-left: auto; background: var(--pop); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; line-height: 1.4; }
.sideNav .cnt:empty { display: none; }
.sideUser { margin-top: 10px; padding: 10px 8px 4px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 9px; }
.sideUser img { width: 28px; height: 28px; border-radius: 50%; background: #fff; flex: none; }
.sideUser .un { display: block; font-size: 13px; font-weight: 600; color: #e6edf7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sideUser a { display: block; font-size: 12px; color: var(--side-dim); text-decoration: none; }
.sideUser a:hover { color: #fff; }
.sideFoot { padding: 6px 8px 0; font-size: 11.5px; color: var(--side-dim); }

/* ===== メイン ===== */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 40; min-height: 58px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 24px; background: rgba(255,255,255,.86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.pageTitle { display: flex; align-items: center; gap: 7px; font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: .01em; }
.pageTitle svg { display: none; }
.topRight { margin-left: auto; display: flex; gap: 6px; align-items: center; font-size: 13px; }
.topRight a { color: var(--brand-ink); text-decoration: none; font-weight: 600; padding: 5px 9px; border-radius: 7px; white-space: nowrap; }
.topRight a:hover { background: var(--brand-soft); }
.content, .main > main { padding: 20px 24px; flex: 1; width: 100%; max-width: 1560px; }

/* ===== コントロール ===== */
/* ボタンの土台。特異度 0（:where）なので、各ページ固有のボタン（打刻ボタン・日付チップ等）の指定がそのまま勝つ */
:where(.main, .overlay) :where(button) { font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.25; padding: 8px 15px; border: 1px solid var(--line2); background: #fff; color: var(--txt); border-radius: var(--r-sm); cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s, color .15s; }
:where(.main, .overlay) :where(button):hover { background: #f4f8fc; border-color: #b3c2d4; }
button.primary { background: var(--grad); color: #fff; border: 1px solid transparent; border-radius: var(--r-sm); padding: 8px 17px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; box-shadow: 0 6px 16px -8px rgba(47,155,255,.9); }
button.primary:hover { background: var(--grad); filter: saturate(1.08) brightness(1.04); box-shadow: 0 8px 20px -8px rgba(47,155,255,1); border-color: transparent; }
button.ghost { background: #fff; color: var(--txt); border: 1px solid var(--line2); border-radius: var(--r-sm); padding: 8px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
button.ghost:hover { background: #f4f8fc; border-color: #b3c2d4; }
button.danger { color: var(--bad); border-color: var(--bad-line); }
button.danger:hover { background: var(--bad-soft); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
select, input[type=month], input[type=number], input[type=text], input[type=time], input[type=password], input[type=date], input[type=email], input[type=tel], textarea {
  padding: 7px 10px; border: 1px solid var(--line2); border-radius: var(--r-sm); font-size: 14px; background: #fff; font-family: inherit; color: var(--txt); transition: border-color .15s, box-shadow .15s;
}
select:hover, input:hover, textarea:hover { border-color: #aebdd0; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--b1); box-shadow: 0 0 0 3px rgba(47,155,255,.18); }
input[type=number] { font-variant-numeric: tabular-nums; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar label { font-size: 13px; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); line-height: 1.7; }

/* セグメント切替（選択中は白地＋ブランド文字。グラデにしない） */
.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: #eef3f9; }
.seg button { border: none; background: transparent; padding: 6px 16px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit; border-radius: 8px; transition: background .15s, color .15s; }
.seg button + button { border-left: none; }
.seg button:hover { background: rgba(255,255,255,.7); color: var(--ink); border: none; }
.seg button.active { background: #fff; color: var(--brand-ink); font-weight: 700; box-shadow: 0 1px 2px rgba(20,35,60,.08), 0 2px 6px -2px rgba(20,35,60,.15); }

/* ステータスピル・バッジ（対面=青・オンライン=水色 の意味は変えない） */
.pill { display: inline-block; font-size: 12.5px; padding: 4px 14px; border-radius: 999px; background: #eef3f9; color: var(--muted); font-weight: 700; }
.pill.on { background: var(--blue-pale); color: var(--blue); }
.pill.onl { background: var(--cyan-pale); color: #0369a1; }
.badge { display: inline-block; font-size: 11.5px; padding: 2px 9px; border-radius: 999px; font-weight: 700; }
.badge.onsite { background: var(--blue); color: #fff; }
.badge.online { background: var(--cyan-pale); color: #0369a1; border: 1px solid var(--cyan); }

/* サマリーカード */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 18px 12px; min-width: 124px; box-shadow: var(--shadow); }
.stat .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat .val { font-size: 24px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.3; letter-spacing: -.01em; }
.stat .val small { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-left: 2px; letter-spacing: 0; }

/* 一覧表（縦罫線なし・行罫線で読む） */
table.data { border-collapse: separate; border-spacing: 0; background: #fff; width: 100%; font-size: 13px; }
table.data th, table.data td { border-bottom: 1px solid #edf1f6; padding: 8px 10px; text-align: left; vertical-align: middle; }
table.data th { background: #f6f9fc; color: var(--muted); white-space: nowrap; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: #f9fbfe; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data :where(button) { white-space: nowrap; padding: 5px 10px; font-size: 13px; border-radius: 7px; }
table.data tfoot td { background: #f6f9fc; font-weight: 700; color: var(--ink); border-top: 1px solid var(--line2); }
.scrollX { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow); scrollbar-width: thin; scrollbar-color: #c3cfdd transparent; }

/* モーダル・トースト */
.overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 16px; padding: 22px 24px 20px; width: min(94vw, 560px); max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); color: var(--txt); }
.modalBtns { display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end; }
#toast { display: none; position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 11px; font-size: 14px; font-weight: 600; z-index: 60; max-width: 90vw; box-shadow: var(--shadow-lg); }

/* お知らせバナー */
.notice { background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: var(--r-sm); padding: 10px 16px; font-size: 13.5px; color: var(--txt); display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== 900px 以下: サイドバーを上に畳み（横並び・ナビはチップ）→ 上部バー → 本文 ===== */
@media (max-width: 900px) {
  body { flex-direction: column; }
  .side { position: static; width: 100%; min-width: 0; height: auto; align-self: stretch; overflow: visible; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; padding: 10px 12px 12px; background: var(--side); }
  .side .brand { width: 100%; display: flex; align-items: center; gap: 10px; padding: 0 4px 10px; margin-bottom: 6px; }
  .side .brandsub { margin-top: 0; }
  .appSwitch { width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); padding-bottom: 10px; margin-bottom: 6px; }
  .sideNav { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .navGroup { display: none; }
  .sideNav a, .sideNav button { width: auto; white-space: nowrap; padding: 7px 12px; font-size: 13.5px; background: rgba(255,255,255,.06); border-radius: 999px; }
  .sideNav .ico { display: none; }
  .sideUser { margin: 6px 0 0; padding: 8px 4px 0; width: 100%; }
  .sideFoot { display: none; }
  .topbar { position: static; background: #fff; padding: 8px 14px; min-height: 0; gap: 8px 10px; }
  .pageTitle { font-size: 15.5px; }
  .content, .main > main { padding: 14px 14px 24px; }
  /* 一覧表は語の途中で折らない（収まらない分は .scrollX の中で横スクロール） */
  table.data td { word-break: keep-all; }
}
/* span#adminNavLinks（打刻・出勤簿の「労務管理」）は JS が display を none / block で切り替える。畳んだときはその中のチップだけが見える */

@media print {
  .side, .topbar, .toolbar, .noPrint { display: none !important; }
  body { background: #fff; display: block; }
  .content { padding: 0; }
  .scrollX { border: none; border-radius: 0; overflow: visible; }
}
/* 画面用に足した影・余白が印刷に出ないようにする（印刷の見た目は旧デザインのまま） */
@media print {
  /* 画面用に上げた本文サイズ・行間・書体が支払調書（高さ固定の上下 2 面）などに波及しないよう、印刷時は旧デザインの基準に戻す */
  body { font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif; font-size: 16px; line-height: normal; color: #221c17; }
  .scrollX, .stat, .payBox { box-shadow: none; }
  .content, .main > main { max-width: none; }
}
