/* 有休管理アプリ。色はここの :root だけで決める（マネーフォワード クラウド風の青・見やすさ重視） */
:root {
  --primary: #1F6FEB;
  --primary-dark: #1557c0;
  --primary-soft: #e8f0fe;
  --background: #f5f7fa;
  --foreground: #1f2937;
  --sub: #4b5563;
  --meta: #6b7280;
  --line: #e2e6eb;
  --card: #ffffff;
  --red: #c81e1e; --red-bg: #fff1f2; --red-line: #fecdd3;
  --amber: #92400e; --amber-bg: #fffbeb; --amber-line: #fde68a;
  --green: #047857; --green-bg: #ecfdf5; --green-line: #a7f3d0;
  --gray-bg: #f3f4f6;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --font-sans: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  --font-size-base: 16px;
}
* { box-sizing: border-box; }
html { font-size: var(--font-size-base); }
body { margin: 0; background: var(--background); color: var(--foreground); font-family: var(--font-sans); line-height: 1.6; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
a { color: var(--primary); }
.num, td.n, .stat b { font-variant-numeric: tabular-nums; }

/* 上の帯 */
header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; }
.logo .mk { width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.logo h1 { font-size: 18px; margin: 0; font-weight: 700; }
header .sp { flex: 1; }
.pill { font-size: 14px; color: var(--sub); }
.envb { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-line); }

/* メニューと本文 */
.layout { display: flex; min-height: calc(100vh - 56px); }
nav { width: 232px; flex: none; background: #fff; border-right: 1px solid var(--line); padding: 16px 12px; }
nav .grp { font-size: 12px; color: var(--meta); margin: 16px 10px 6px; }
nav button { display: flex; align-items: center; gap: 10px; width: 100%; height: 44px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: var(--foreground); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
nav button:hover { background: var(--gray-bg); }
nav button.on { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
nav .cnt { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px; display: grid; place-items: center; }
main { flex: 1; min-width: 0; padding: 24px; max-width: 1280px; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
h2.page { font-size: 24px; margin: 0 0 4px; }
.lead { color: var(--sub); margin: 0 0 20px; font-size: 15px; }

/* カード・集計 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card h3 { font-size: 18px; margin: 0 0 12px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat span { display: block; font-size: 13px; color: var(--meta); }
.stat b { display: block; font-size: 26px; line-height: 1.3; margin-top: 4px; }
.stat small { color: var(--meta); font-size: 13px; }
.stat.main { border-top: 3px solid var(--primary); }
.stat.warn { border-top: 3px solid var(--red); }

/* 表 */
.tw { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: #f9fafb; font-size: 13px; font-weight: 600; color: var(--sub); }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; }
tr.stall td { background: var(--red-bg); }
tr.retired td { color: var(--meta); }
tbody tr:hover td { background: #f8fafc; }
tbody tr.stall:hover td { background: #ffe4e6; }

/* バッジ */
.bd { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid; white-space: nowrap; }
.bd.wait { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.bd.ok { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.bd.ng { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.bd.off { background: var(--gray-bg); color: var(--meta); border-color: var(--line); }
.bd.role { background: var(--primary-soft); color: var(--primary); border-color: #c7d9fb; }
.redtxt { color: var(--red); font-weight: 600; }

/* ボタン・入力 */
button.p, button.s, button.x, a.p { height: 40px; padding: 0 18px; border-radius: 6px; font: inherit; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
button.p, a.p { background: var(--primary); color: #fff; border: 1px solid var(--primary); font-weight: 600; }
button.p:hover { background: var(--primary-dark); }
button.s { background: #fff; color: var(--foreground); border: 1px solid #cfd5dc; }
button.s:hover { background: var(--gray-bg); }
button.s.danger { color: var(--red); border-color: var(--red-line); }
button.x { background: none; border: 0; color: var(--sub); padding: 0 8px; }
button.x:hover { color: var(--primary); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.sm { height: 32px; padding: 0 12px; font-size: 14px; }
.wide { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 12px; }
label { display: block; font-size: 14px; font-weight: 600; color: var(--sub); margin: 14px 0 6px; }
input, select, textarea { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #cfd5dc; border-radius: 6px; font: inherit; font-size: 16px; background: #fff; color: var(--foreground); }
textarea { height: 80px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31, 111, 235, .2); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; vertical-align: middle; }
.seg { display: inline-flex; border: 1px solid #cfd5dc; border-radius: 6px; overflow: hidden; }
.seg label { margin: 0; padding: 0 18px; height: 40px; display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; color: var(--foreground); border-right: 1px solid #cfd5dc; }
.seg label:last-child { border-right: 0; }
.seg input { display: none; }
.seg label.on { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.hint { font-size: 14px; color: var(--meta); margin: 6px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 14px; }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 6px; }

/* 状態の箱 */
.box { border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; font-size: 15px; border: 1px solid; }
.box.err { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.box.ok { background: var(--green-bg); border-color: var(--green-line); color: var(--green); }
.box.warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.box.info { background: var(--primary-soft); border-color: #c7d9fb; color: #1e40af; }
.empty { text-align: center; padding: 40px 20px; color: var(--sub); }
.empty .ic { width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.empty p { margin: 0 0 14px; }
.sk { height: 48px; border-radius: 6px; background: linear-gradient(90deg, #eef1f4, #f7f8fa, #eef1f4); background-size: 200% 100%; animation: sk 1.2s infinite; margin-bottom: 8px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ログイン */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--background); }
.login .card { width: 100%; max-width: 420px; padding: 32px; }
.login h2 { margin: 0 0 4px; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.msg { margin-top: 12px; color: var(--red); font-size: 14px; }
.msg.okmsg { color: var(--green); }

/* ダイアログ・知らせ */
.dlg { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .4); display: grid; place-items: center; padding: 16px; }
.dlg .panel { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; padding: 24px; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.dlg h3 { margin: 0 0 8px; font-size: 20px; }
.dlg .row.end { margin-top: 20px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: #065f46; color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 15px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: calc(100vw - 32px); }
.toast.err { background: var(--red); }
.busy { position: fixed; inset: 0; z-index: 70; background: rgba(255,255,255,.6); display: grid; place-items: center; font-weight: 600; color: var(--sub); }
.hist { list-style: none; margin: 8px 0 0; padding: 0; }
.hist li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.hist li small { color: var(--meta); display: block; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 15px; }
.kv dt { color: var(--meta); }
.kv dd { margin: 0; }

/* スマホ・狭い画面 */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  header { padding: 0 12px; }
  .logo h1 { font-size: 16px; }
  .pill { display: none; }
  .layout { display: block; }
  nav { width: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; display: flex; gap: 4px; overflow-x: auto; position: sticky; top: 56px; z-index: 10; }
  nav .grp { display: none; }
  nav button { width: auto; flex: none; height: 38px; font-size: 14px; white-space: nowrap; }
  main { padding: 16px; }
  h2.page { font-size: 20px; }
  .grid2 { grid-template-columns: 1fr; }
  .stat b { font-size: 22px; }
  th, td { padding: 10px; }
}
@media (max-width: 420px) { .stats { grid-template-columns: 1fr 1fr; gap: 8px; } .stat { padding: 12px; } }

/* 印刷（管理表） */
@media print {
  header, nav, .noprint, .toast { display: none !important; }
  body, main { background: #fff; padding: 0; }
  .tw { border: 0; box-shadow: none; overflow: visible; }
  table { font-size: 11px; }
  th, td { padding: 4px 6px; border: 1px solid #999; }
  .printpage { page-break-after: always; }
  .printpage:last-child { page-break-after: auto; }
  h3.ptitle { font-size: 16px; margin: 0 0 8px; }
}
.onlyprint { display: none; }
@media print { .onlyprint { display: block; } }

/* 決算準備のお願い：A4縦1枚。事務所のExcelの書式に合わせる（印刷だけで使う） */
.kform { page-break-after: always; color: #000; font-family: "MS Gothic", "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif; font-size: 10.5pt; line-height: 1.32; }
.kform:last-child { page-break-after: auto; }
.kform h1 { font-family: "MS Mincho", "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 18pt; font-weight: 700; text-align: center; margin: 0 0 8pt; }
.kform .kto { font-size: 13pt; margin: 0 0 8pt; }
.kform .kto span { display: inline-block; min-width: 62%; border-bottom: 1px solid #000; }
.kform .kmsg { margin: 0 0 8pt; }
.kform .kdates { display: grid; grid-template-columns: 16% 30% 16% 38%; border: 1px solid #000; margin-bottom: 8pt; align-items: stretch; }
.kform .kdates > div { padding: 3pt 6pt; display: flex; flex-direction: column; justify-content: center; }
.kform .kl { background: #e7e6e6; print-color-adjust: exact; -webkit-print-color-adjust: exact; text-align: center; }
.kform .kh { font-weight: 700; margin: 6pt 0 2pt; }
.kform table { width: 100%; border-collapse: collapse; font-size: 10pt; }
.kform th, .kform td { border: 1px solid #000; padding: 2pt 4pt; vertical-align: middle; text-align: left; }
.kform th { background: #e7e6e6; print-color-adjust: exact; -webkit-print-color-adjust: exact; font-weight: 400; text-align: center; }
.kform .ck { width: 9%; text-align: center; }
.kform .nm { width: 22%; }
.kform .kfoot { margin: 8pt 0 0; font-size: 11pt; }

/* 自家用車燃料費請求書：A4縦。事務所のExcelの様式に合わせる（印刷だけで使う） */
.fform { page-break-after: always; color: #000; font-family: "MS Gothic", "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif; font-size: 10pt; }
.fform:last-child { page-break-after: auto; }
.fform h1 { font-size: 15pt; font-weight: 700; text-align: center; margin: 0 0 8pt; }
.fform .fym { margin: 0 0 6pt; font-size: 11pt; }
.fform .fhead { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 6pt; font-size: 11pt; }
.fform .fhead span { display: inline-block; min-width: 56mm; border-bottom: 1px solid #000; }
.fform .fhead b { display: inline-block; margin-left: 10mm; font-weight: 400; }
.fform table { width: 99.6%; border-collapse: collapse; table-layout: fixed; font-size: 8.5pt; }
.fform th, .fform td { border: 1px solid #000; padding: 0 2pt; height: 7.6mm; white-space: normal; line-height: 1.1; overflow: hidden; color: #000; background: #fff; font-weight: 400; }
.fform th { text-align: center; }
.fform .fd { width: 7%; text-align: center; }
.fform .fk { width: 12%; text-align: right; }
.fform th.fk { text-align: center; }
.fform .fsum { text-align: center; }
.fform tr:last-child td { border-bottom: 1px solid #000; }
.fform .fnote { text-align: right; margin: 3pt 0 0; font-size: 9pt; }
/* 燃料費の記入 */
.fline { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; margin-top: 8px; }
.fline label { margin: 0; font-weight: 400; white-space: nowrap; display: flex; gap: 4px; align-items: center; }
.fdaybtn { width: 100%; height: 42px; text-align: left; }
.fcal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); text-align: center; }
.fcal .fcalhead { grid-column: 1 / -1; font-weight: 700; margin-bottom: 4px; }
.fcal b { font-size: 13px; font-weight: 600; color: var(--meta); }
.fcal button { height: 40px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--foreground); font: inherit; cursor: pointer; }
.fcal button:hover { background: var(--gray-bg); }
.fcal button.sun { color: var(--red); }
.fcal button.sat { color: var(--primary); }
.fcal button.now { border-color: var(--primary); }
.fcal button.on { background: var(--primary); color: #fff; }
td.fwrap { white-space: normal; min-width: 180px; }
tr.fsub td { border-top: 0; }

/* 最初の画面の項目選び */
.layout.nonav { display: block; }
.apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; max-width: 640px; }
.app { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); font: inherit; color: var(--foreground); cursor: pointer; min-height: 110px; }
button.app:hover { border-color: var(--primary); }
.app b { font-size: 20px; }
.app small { font-size: 14px; color: var(--meta); }
.app.off { background: var(--gray-bg); box-shadow: none; cursor: default; color: var(--meta); }
nav .back { color: var(--meta); font-size: 14px; }

/* 決算事前検討表の印刷（C18）。セル・罫線は lib/jizen-sheet.js（事務所のExcelから作る）のとおりに出す */
.jform { --jmin: "MS PMincho", "ＭＳ Ｐ明朝", "Yu Mincho", "Hiragino Mincho ProN", serif; color: #000; font-family: "MS PGothic", "ＭＳ Ｐゴシック", "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif; }
.jform .jsheet { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 10pt; }
.jform .jsheet tr > td { padding: 0 2pt; border: 0; background-clip: padding-box; vertical-align: middle; white-space: nowrap; overflow: hidden; line-height: 1.15; color: #000; height: auto; }
.jform .jsheet td.jrot { writing-mode: vertical-rl; text-orientation: upright; text-align: center; white-space: normal; letter-spacing: 0; }
.jform .jsheet .jn { display: block; text-align: right; font-family: "MS Gothic", "ＭＳ ゴシック", "Osaka-Mono", monospace; font-variant-numeric: tabular-nums; }
.jform .jsheet .jc { display: block; text-align: center; font-family: "MS Gothic", "ＭＳ ゴシック", monospace; }
.jform .jsheet .jname { font-size: 13pt; font-weight: 700; font-family: var(--jmin); }
.jform .jsheet .jlab { writing-mode: horizontal-tb; font-size: 8pt; }

/* 決算事前検討の入力（C18） */
.jgrid th { white-space: nowrap; font-weight: 600; }
.jgrid td.jc { padding: 4px; min-width: 96px; vertical-align: top; }
.jgrid .jin { width: 100%; min-width: 84px; height: 36px; text-align: right; font-variant-numeric: tabular-nums; padding: 0 6px; }
.jgrid .jtx { min-width: 110px; height: 36px; }
.jgrid td.calc .jin { background: var(--gray-bg); }
.jgrid td.ov .jin { background: var(--amber-bg); border-color: var(--amber-line); }
.jgrid .jin.ng { border-color: var(--red); background: var(--red-bg); }
.jgrid .jprev { display: block; color: var(--meta); font-size: 12px; text-align: right; }
.jgrid .jback { height: 24px; font-size: 12px; padding: 0 4px; }
/* 決算事前検討のまとめ一覧（C18） */
.jsum .jup { color: var(--green); font-weight: 600; }
.jsum .jdown { color: var(--red); font-weight: 600; }
.jsum .jlink { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.jsum tr.jtotal td { border-top: 2px solid var(--line); background: #f9fafb; }
/* 取得日が土曜・日曜のとき、日付の文字だけ色を付ける（行の赤い帯とは別） */
span.sat { color: var(--primary); font-weight: 600; }
span.sun { color: var(--red); font-weight: 600; }
