/* 工賃計算ソフト スタイル */
:root {
  --primary: #1f7a6b;
  --primary-light: #2fa088;
  --warn: #c0584b;
  --bg: #f6f8fb;
  --card: #ffffff;
  --border: #e2e6ee;
  --text: #1a1f2c;
  --muted: #6b7280;
  --sat: #e2eafc;
  --sun: #fde2e4;
  --success: #2f8a4d;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { background: var(--primary); color: white; display: flex; align-items: center; padding: 0 24px; height: 56px; }
.topbar .logo { font-weight: 700; font-size: 18px; margin-right: 32px; color: white; text-decoration: none; }
.topbar a.logo:hover { text-decoration: none; opacity: 0.85; }
.topbar nav { display: flex; gap: 18px; flex: 1; }
.topbar nav a { color: rgba(255,255,255,0.9); padding: 4px 6px; border-radius: 4px; }
.topbar nav a:hover { background: rgba(255,255,255,0.12); text-decoration: none; }
.topbar .userbox { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.topbar .userbox form { margin: 0; }
.topbar .userbox .btn {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.35);
  padding: 5px 12px;
  font-size: 12px;
}
.topbar .userbox .btn:hover { background: rgba(255,255,255,0.28); opacity: 1; }
.topbar .office-switch {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.topbar .office-switch option { color: #222; }
.topbar .userbox .user-name { opacity: 0.85; }
.topbar .userbox .manual-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: white;
  opacity: 0.9;
  border-radius: 6px;
  text-decoration: none;
}
.topbar .userbox .manual-icon:hover { background: rgba(255,255,255,0.18); opacity: 1; text-decoration: none; }

.cash-group { margin: 16px 0 24px; padding: 12px 16px; border: 1px solid var(--border, #ddd); border-radius: 6px; background: #fff; }
.cash-group h3 { margin: 0 0 10px; font-size: 15px; border: none; padding: 0; display: flex; align-items: baseline; gap: 12px; }
.cash-group .cash-group-net { font-size: 13px; color: var(--primary); font-weight: 700; }
.cash-group-body { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }

.container { max-width: 1200px; margin: 24px auto; padding: 0 24px; }
.footer { text-align: center; color: var(--muted); padding: 24px 0; font-size: 12px; }

h1 { margin: 0 0 16px; font-size: 22px; }
h2 { margin: 28px 0 12px; font-size: 17px; border-bottom: 2px solid var(--primary); padding-bottom: 4px; }
h3 { margin: 20px 0 10px; font-size: 15px; }

.row-between { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; }

.card { background: var(--card); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); padding: 24px; margin-bottom: 24px; }

.clock-card { text-align: center; max-width: 720px; margin: 0 auto 24px; }
.now-time { font-size: 56px; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.now-date { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.punch-status { display: flex; justify-content: center; gap: 40px; margin: 16px 0 24px; }
.status-item .status-label { font-size: 12px; color: var(--muted); }
.status-item .status-value { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.punch-buttons { display: flex; justify-content: center; gap: 16px; }

.btn { display: inline-block; border: none; border-radius: 6px; padding: 8px 16px; font-size: 14px; cursor: pointer; font-family: inherit; transition: 0.15s; text-decoration: none; }
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn-primary { background: var(--primary); color: white; }
.btn-warn { background: var(--warn); color: white; }
.btn-ghost { background: rgba(31,58,104,0.08); color: var(--primary); }
.btn-block { width: 100%; }
.btn-big { font-size: 20px; padding: 14px 36px; min-width: 140px; }
.btn-sm { font-size: 12px; padding: 4px 10px; }

.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.summary-card { background: var(--card); border-radius: 8px; padding: 14px 18px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.summary-card .summary-label { font-size: 12px; color: var(--muted); }
.summary-card .summary-value { font-size: 22px; font-weight: 600; color: var(--primary); font-variant-numeric: tabular-nums; }

.attendance-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 8px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,0.04); font-size: 13px; }
.attendance-table th { background: var(--primary); color: white; padding: 8px 6px; font-weight: 500; text-align: center; }
.attendance-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); }
.attendance-table tbody tr:last-child td { border-bottom: none; }
.attendance-table tr.sat { background: var(--sat); }
.attendance-table tr.sun { background: var(--sun); }
.attendance-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.attendance-table input[type="time"], .attendance-table input[type="text"] { padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px; font-family: inherit; font-size: 13px; width: 100%; }
.attendance-table input[type="time"] { width: 90px; }

.month-selector { display: flex; gap: 6px; align-items: center; }
.month-selector select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; background: white; }

/* 月次画面のナビゲーション（前月◀ [セレクタ] 次月▶） */
.month-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.month-nav .spacer { flex: 1; }
.nav-arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: white; border: 1px solid var(--border); border-radius: 50%;
  color: var(--primary); font-size: 16px; text-decoration: none;
  transition: 0.15s;
}
.nav-arrow:hover { background: var(--primary); color: white; text-decoration: none; transform: scale(1.05); }

/* バルク保存ツールバー */
.bulk-toolbar { display: flex; align-items: center; gap: 16px; margin: 12px 0; padding: 10px 14px; background: #eef2f8; border-radius: 6px; }
.bulk-toolbar .hint { margin: 0; font-size: 12px; }
.bulk-toolbar.end { justify-content: flex-end; }

/* 編集行（管理画面） */
.edit-row { background: #fbfcfe; }
.edit-row td { padding: 16px 12px !important; border-top: 2px solid var(--primary) !important; }
.edit-form { display: block; }
.edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.edit-grid label { display: block; font-size: 12px; color: var(--muted); }
.edit-grid input[type="text"], .edit-grid input[type="number"], .edit-grid input[type="password"] {
  display: block; width: 100%; padding: 6px 8px; margin-top: 3px;
  border: 1px solid var(--border); border-radius: 4px; font-family: inherit; font-size: 13px;
}
.edit-grid label.checkbox { display: flex; align-items: center; gap: 6px; margin-top: 18px; }
.edit-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 8px; border-top: 1px dashed var(--border); }
.edit-actions .divider { color: var(--border); }
.edit-actions input[type="password"] { padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }

/* 新規作成フォーム（grid） */
.form-grid { max-width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.form-grid label { margin-bottom: 0; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .checkbox { display: flex; align-items: center; gap: 6px; }

.small { font-size: 11px; }
.note-input { width: 100%; min-width: 120px; }
kbd { background: #eef2f8; border: 1px solid var(--border); border-radius: 3px; padding: 1px 6px; font-size: 11px; font-family: inherit; }

/* コンパクト表 */
.attendance-table.compact td { padding: 2px 4px; }
.attendance-table.compact input[type="time"] { width: 88px; font-variant-numeric: tabular-nums; }
.attendance-table.compact input[type="text"] { padding: 3px 6px; }

/* 月次入力: 氏名列は折り返さない（1文字ずつ縦書きになるのを防ぐ） */
.attendance-table th:first-child,
.attendance-table td:first-child { white-space: nowrap; }
/* 数値入力欄: 右寄せ・等幅数字。type=number のスピナーは詰める */
.attendance-table input[type="number"] {
  padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px;
  font-family: inherit; font-size: 13px; text-align: right;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.attendance-table input[type="number"]::-webkit-outer-spin-button,
.attendance-table input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.search-form { display: flex; gap: 12px; align-items: end; margin: 12px 0; flex-wrap: wrap; }
.search-form label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.search-form input { padding: 6px; border: 1px solid var(--border); border-radius: 4px; }

.form-card { background: var(--card); border-radius: 8px; padding: 24px; max-width: 480px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.form-card label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.form-card input { display: block; width: 100%; padding: 8px 10px; margin-top: 4px; border: 1px solid var(--border); border-radius: 4px; font-family: inherit; font-size: 14px; color: var(--text); }
.form-inline { max-width: 100%; display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.form-inline label { margin-bottom: 0; }
.form-inline input { width: auto; }
.form-card .checkbox { display: inline-flex; align-items: center; gap: 6px; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert.error { background: #fde2e4; color: var(--warn); border: 1px solid #f5b5b9; }
.alert.success { background: #e6f4ea; color: var(--success); border: 1px solid #b7dfc4; }
.alert.info { background: #e3eefb; color: var(--primary); border: 1px solid #b8d2f0; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1f7a6b 0%, #2fa088 100%); margin: 0; }
.login-card { background: white; padding: 36px 40px; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.15); width: 360px; }
.login-card h1 { text-align: center; color: var(--primary); margin: 0 0 4px; }
.login-card .subtitle { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.login-card input { display: block; width: 100%; padding: 10px; margin-top: 4px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 14px; }

.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
.muted { color: var(--muted); }
.disabled-row { opacity: 0.5; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; margin-right: 2px; }
.badge.admin { background: var(--primary); color: white; }
.badge.payroll { background: #f3a712; color: white; }
.actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.actions input { padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }
small { font-size: 11px; color: var(--muted); }

/* パスワード表示トグル */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap input { width: 100%; padding-right: 64px; box-sizing: border-box; }
.pw-wrap .pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border: 1px solid #ccc;
  padding: 4px 10px;
  font-size: 12px;
  color: #555;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
  line-height: 1;
}
.pw-wrap .pw-toggle:hover { background: #f0f0f0; opacity: 1; }


/* === 削除機能（追加） === */
.btn-danger {
  background-color: #d93025;
  color: #fff;
  border: 1px solid #d93025;
}
.btn-danger:hover { background-color: #b1271b; border-color: #b1271b; opacity: 1; }
.delete-row td { background-color: #fff5f5; }
.delete-form .danger-msg {
  color: #b1271b;
  font-size: 14px;
  margin: 8px 0 12px;
  line-height: 1.6;
}
.delete-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.delete-grid input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
}

/* === 経理エリア === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.feature-card {
  display: block;
  padding: 18px 20px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, transform 0.15s;
}
.feature-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.feature-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}
.feature-card p {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.feature-card.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #fafafa;
}

/* === 経費申請のステータスバッジ === */
.badge.status-draft     { background: #9aa0a6; color: white; }
.badge.status-submitted { background: #f0ad4e; color: white; }
.badge.status-pending   { background: #f0ad4e; color: white; }  /* 旧互換 */
.badge.status-paid      { background: #2f8a4d; color: white; }
.badge.status-rejected  { background: #c0584b; color: white; }
.badge.status-canceled  { background: #9aa0a6; color: white; }  /* 旧互換 */

/* === 経費申請：詳細テーブル === */
.detail-table {
  width: 100%;
  border-collapse: collapse;
}
.detail-table th {
  text-align: left;
  width: 140px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #fafbfd;
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
  vertical-align: top;
}
.detail-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.detail-table tr:last-child th,
.detail-table tr:last-child td { border-bottom: none; }

/* === 経費フォーム === */
.form-grid select,
.form-grid input[type="date"],
.form-grid input[type="number"],
.form-grid input[type="text"],
.form-grid input[type="file"],
.form-grid textarea {
  display: block;
  width: 100%;
  padding: 6px 8px;
  margin-top: 3px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  box-sizing: border-box;
}
.form-grid textarea { resize: vertical; }

/* === 利用マニュアル === */
.manual-intro { font-size: 14px; color: var(--text); line-height: 1.8; margin: 0 0 4px; }
.manual-toc {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 20px 0 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.manual-toc h2 { margin: 0 0 12px; font-size: 15px; border: none; padding: 0; color: var(--primary); }
.manual-toc ol { margin: 0; padding-left: 0; list-style: none; counter-reset: toc; }
.manual-toc li { counter-increment: toc; margin: 0; }
.manual-toc li a {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  color: var(--text); font-size: 14px;
}
.manual-toc li a:hover { background: #eef2f8; text-decoration: none; }
.manual-toc li a::before {
  content: counter(toc);
  flex: 0 0 24px; height: 24px; line-height: 24px;
  text-align: center; border-radius: 50%;
  background: var(--primary); color: white;
  font-size: 12px; font-weight: 700;
}
.manual-toc li a .toc-desc { color: var(--muted); font-size: 12px; margin-left: 4px; }

.manual-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px 28px;
  margin-bottom: 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  scroll-margin-top: 70px;
}
.manual-section > h2 {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 8px; font-size: 19px;
  border: none; padding: 0;
}
.manual-section > h2 .step-no {
  flex: 0 0 34px; height: 34px; line-height: 34px;
  text-align: center; border-radius: 50%;
  background: var(--primary); color: white;
  font-size: 16px; font-weight: 700;
}
.manual-section .lead { color: var(--muted); font-size: 14px; line-height: 1.8; margin: 0 0 16px; }

.manual-shot {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  margin: 8px 0 20px;
}

.manual-steps { margin: 0; padding-left: 0; list-style: none; counter-reset: step; }
.manual-steps > li {
  counter-increment: step;
  position: relative;
  padding: 10px 0 10px 44px;
  border-bottom: 1px dashed var(--border);
  font-size: 14px; line-height: 1.8;
}
.manual-steps > li:last-child { border-bottom: none; }
.manual-steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 10px;
  width: 28px; height: 28px; line-height: 28px;
  text-align: center; border-radius: 50%;
  background: #eef2f8; color: var(--primary);
  font-size: 13px; font-weight: 700;
}
.manual-steps strong { color: var(--primary); }

.manual-tip {
  display: flex; gap: 10px;
  background: #e6f4ea; border: 1px solid #b7dfc4;
  border-radius: 8px; padding: 12px 16px; margin: 16px 0 0;
  font-size: 13px; line-height: 1.8; color: #1f6b3a;
}
.manual-tip.warn { background: #fff6e5; border-color: #f3d28a; color: #8a5a00; }
.manual-tip .tip-ico { flex: 0 0 auto; font-weight: 700; }

.manual-key { display: inline-block; background: #eef2f8; border: 1px solid var(--border); border-radius: 4px; padding: 1px 8px; font-size: 13px; font-weight: 600; color: var(--primary); }

.manual-top-link { display: inline-block; margin-top: 14px; font-size: 12px; color: var(--muted); }
