/* ===== 派遣事業統合管理 スタイル ===== */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Yu Gothic UI", "Meiryo", "Hiragino Sans", sans-serif;
  background: #f4f6f8;
  color: #222;
  font-size: 14px;
}

header {
  background: linear-gradient(135deg, #305496, #4a6fb5);
  color: #fff;
  padding: 12px 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: bold;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.toolbar label {
  font-size: 13px;
  opacity: 0.9;
}

.toolbar select,
.toolbar button {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.95);
  color: #222;
  cursor: pointer;
}

.toolbar button:hover {
  background: #fff;
  border-color: #fff;
}

.toolbar button.primary {
  background: #ffc107;
  border-color: #ffc107;
  font-weight: bold;
}

.toolbar button.primary:hover {
  background: #ffb300;
}

.toolbar .spacer {
  flex: 1;
}

.toolbar #yearSelector { min-width: 84px; }
.toolbar #monthSelector { min-width: 64px; }

.toolbar .ym-sep {
  font-size: 13px;
  opacity: 0.9;
  margin-left: -4px;
  margin-right: 2px;
}

/* ===== メインタブ ===== */
.main-tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #ccc;
  padding: 0 20px;
  overflow-x: auto;
}

.main-tab {
  padding: 12px 20px;
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  color: #555;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.main-tab.active {
  color: #305496;
  font-weight: bold;
  border-bottom-color: #305496;
}

.main-tab:hover {
  background: #f0f4fa;
}

/* ===== メインエリア ===== */
main {
  padding: 16px 20px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ===== サブタブ ===== */
.sub-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid #ddd;
}

.sub-tab {
  padding: 8px 16px;
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 13px;
  font-family: inherit;
  color: #666;
  border-bottom: 2px solid transparent;
}

.sub-tab.active {
  color: #305496;
  font-weight: bold;
  border-bottom-color: #305496;
}

.sub-tab:hover {
  background: #f0f4fa;
}

/* ===== カード/パネル ===== */
.panel {
  background: #fff;
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.panel h2, .panel h3 {
  margin: 0 0 10px 0;
}

.panel h2 { font-size: 16px; color: #305496; }
.panel h3 { font-size: 14px; color: #444; }

/* ===== コントロール行 ===== */
.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.control-row label {
  font-size: 13px;
  color: #555;
}

.control-row select,
.control-row input[type="text"],
.control-row input[type="number"],
.control-row input[type="month"] {
  padding: 5px 8px;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}

.control-row button {
  font-family: inherit;
  font-size: 13px;
  padding: 5px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.control-row button.primary {
  background: #305496;
  color: #fff;
  border-color: #305496;
}

.control-row button.primary:hover { background: #244478; }

.control-row button.success {
  background: #2e7d32;
  color: #fff;
  border-color: #2e7d32;
}

.control-row button.danger {
  background: #c62828;
  color: #fff;
  border-color: #c62828;
}

/* ===== サマリパネル ===== */
.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
}

.summary-item {
  display: flex;
  flex-direction: column;
}

.summary-item .label {
  font-size: 12px;
  color: #777;
}

.summary-item .value {
  font-size: 20px;
  font-weight: bold;
  color: #305496;
}

/* ===== テーブル ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.data-table th {
  background: #f4f6f8;
  font-weight: bold;
  color: #555;
}

.data-table td.num,
.data-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table tr:hover {
  background: #fafbfc;
}

.data-table .actions {
  white-space: nowrap;
}

.data-table .actions button {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  margin-right: 4px;
}

.data-table .actions button:hover {
  background: #f0f4fa;
  border-color: #305496;
}

.data-table .badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  background: #e3f2fd;
  color: #1565c0;
  font-size: 11px;
}

.data-table .badge.regular { background: #e8f5e9; color: #2e7d32; }
.data-table .badge.manager { background: #fff3e0; color: #ef6c00; }
.data-table .badge.inactive { background: #eee; color: #999; }

/* ===== カレンダー ===== */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 10px;
}

.cal-head {
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  padding: 6px 0;
  background: #f4f6f8;
  border-radius: 3px;
}

.cal-head.sun { color: #c62828; }
.cal-head.sat { color: #1565c0; }

.cal-cell {
  min-height: 64px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  position: relative;
  transition: background 0.1s;
}

.cal-cell:hover {
  background: #f0f4fa;
  border-color: #305496;
}

.cal-cell.empty {
  background: transparent;
  border: none;
  cursor: default;
}

.cal-cell.sun .day-num { color: #c62828; }
.cal-cell.sat .day-num { color: #1565c0; }
.cal-cell.has-record { background: #f1f8e9; }
.cal-cell.has-record:hover { background: #e8f5e9; }
.cal-cell.holiday { background: #ffebee; }

.cal-cell .day-num {
  font-weight: bold;
  font-size: 13px;
}

.cal-cell .work-time {
  font-size: 11px;
  color: #2e7d32;
  margin-top: 2px;
}

.cal-cell .status-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 2px;
  background: #305496;
  color: #fff;
}

.cal-cell .status-badge.absent { background: #c62828; }
.cal-cell .status-badge.paidLeave { background: #ed6c02; }
.cal-cell .status-badge.holiday { background: #9c27b0; }

/* ===== モーダル ===== */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: #fff;
  border-radius: 8px;
  width: 580px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.modal.large {
  width: 800px;
}

.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid #e8eaed;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
}

.modal-header .close {
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 20px;
  color: #777;
}

.modal-body {
  padding: 16px 20px;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  color: #555;
  margin-bottom: 4px;
  font-weight: bold;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field input[type="time"],
.field input[type="email"],
.field input[type="tel"],
.field select,
.field textarea {
  width: 100%;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.field textarea {
  resize: vertical;
  min-height: 50px;
}

.field-row {
  display: flex;
  gap: 12px;
}

.field-row > .field {
  flex: 1;
}

.fieldset-block {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.fieldset-block .legend {
  font-size: 12px;
  font-weight: bold;
  color: #555;
  margin-bottom: 8px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #e8eaed;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-footer button {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
}

.modal-footer button.primary {
  background: #305496;
  color: #fff;
  border-color: #305496;
}

.modal-footer button.primary:hover {
  background: #244478;
}

.modal-footer button.danger {
  background: #c62828;
  color: #fff;
  border-color: #c62828;
}

/* ===== その他 ===== */
.empty-state {
  padding: 40px;
  text-align: center;
  color: #777;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #323232;
  color: #fff;
  padding: 12px 18px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 200;
  animation: slideIn 0.2s;
}

.toast.error { background: #c62828; }
.toast.success { background: #2e7d32; }

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.totals-line {
  font-size: 14px;
  margin: 10px 0;
  padding: 8px 12px;
  background: #f4f6f8;
  border-radius: 4px;
}

.totals-line strong {
  color: #305496;
  font-size: 16px;
}

.kv-list {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 6px 12px;
  font-size: 13px;
}

.kv-list dt {
  color: #666;
}

.kv-list dd {
  margin: 0;
  font-weight: bold;
}

/* ===== 検索フィルタ ===== */
.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 12px;
  padding: 6px 0;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  max-width: 320px;
  padding: 6px 10px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid #c9c9c9;
  border-radius: 4px;
}

.search-input:focus {
  border-color: #305496;
  outline: none;
  box-shadow: 0 0 0 2px rgba(48,84,150,0.15);
}

.search-count {
  font-size: 12px;
  color: #666;
}

.search-clear {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

.search-clear:hover {
  background: #f0f4fa;
  border-color: #305496;
}

/* ===== 社保: グループタブ ===== */
.shaho-group-tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #ccc;
  margin: 6px 0 12px;
  overflow-x: auto;
}

.shaho-group-tab {
  padding: 8px 16px;
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 13px;
  font-family: inherit;
  color: #555;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.shaho-group-tab.active {
  color: #305496;
  font-weight: bold;
  border-bottom-color: #305496;
}

.shaho-group-tab:hover {
  background: #f0f4fa;
}

/* ===== 社保: サマリ色分け ===== */
.summary-item.kenpo .value { color: #2e7d32; }
.summary-item.kosei .value { color: #ed6c02; }
.summary-item.kaigo .value { color: #9c27b0; }

/* ===== 社保: 会社アコーディオン ===== */
.company-card {
  background: #fff;
  border-radius: 6px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  overflow: hidden;
}

.company-header {
  padding: 12px 18px;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  background: #fafbfc;
  border-bottom: 1px solid #e8eaed;
  user-select: none;
}

.company-header:hover {
  background: #f0f4fa;
}

.company-header .name {
  font-weight: bold;
  font-size: 15px;
  min-width: 180px;
}

.company-header .counts {
  color: #666;
  font-size: 13px;
}

.company-header .totals {
  margin-left: auto;
  display: flex;
  gap: 14px;
  font-size: 13px;
}

.company-header .totals .kenpo { color: #2e7d32; }
.company-header .totals .kosei { color: #ed6c02; }
.company-header .totals .kaigo { color: #9c27b0; }

.company-header .toggle {
  font-size: 13px;
  color: #555;
  width: 16px;
  text-align: center;
  display: inline-block;
  transition: transform 0.15s;
}

.company-body {
  display: none;
  padding: 12px 18px;
}

.company-card.open .company-body {
  display: block;
}

.company-card.open .company-header .toggle {
  transform: rotate(90deg);
}

/* ===== 社保: 従業員テーブル ===== */
.employee-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.employee-table th,
.employee-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.employee-table th {
  background: #f4f6f8;
  font-weight: bold;
  color: #555;
  position: sticky;
  top: 0;
}

.employee-table td.num,
.employee-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.employee-table tr:hover {
  background: #fafbfc;
}

.employee-table tr.no-record td {
  color: #999;
}

.employee-table .name-cell {
  font-weight: bold;
}

.employee-table .actions {
  white-space: nowrap;
}

.employee-table .actions button {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  margin-right: 4px;
}

.employee-table .actions button:hover {
  background: #f0f4fa;
  border-color: #305496;
}

.employee-table .badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  background: #e3f2fd;
  color: #1565c0;
  font-size: 11px;
}

.employee-table .badge.regular { background: #e8f5e9; color: #2e7d32; }
.employee-table .badge.manager { background: #fff3e0; color: #ef6c00; }
.employee-table .dep-yes { color: #d32f2f; font-weight: bold; }
.employee-table .dep-no { color: #aaa; }

.add-employee-btn {
  margin-top: 10px;
  padding: 6px 12px;
  font-size: 13px;
  border: 1px dashed #999;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: #555;
}

.add-employee-btn:hover {
  border-color: #305496;
  color: #305496;
}

/* ===== ダッシュボード: KPIカード ===== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.kpi-card {
  background: #f7f9fc;
  border: 1px solid #dde3ec;
  border-radius: 6px;
  padding: 14px 16px;
  border-left: 5px solid #4F8FF7;
}

.kpi-card.payroll  { border-left-color: #F7B84F; }
.kpi-card.project  { border-left-color: #2e7d32; }
.kpi-card.att      { border-left-color: #9c27b0; }

.kpi-card .kpi-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.kpi-card .kpi-value {
  font-size: 24px;
  font-weight: bold;
  color: #1a1f2c;
  font-variant-numeric: tabular-nums;
}

.kpi-card .kpi-sub {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

.chart-wrap {
  position: relative;
  height: 240px;
  width: 100%;
}

.data-table .row-current {
  background: #fff8dc;
}

.data-table .row-total {
  background: #fdf6e3;
  border-top: 2px solid #d4b878;
}

.data-table .row-total td {
  border-bottom: 2px solid #d4b878;
}

/* ===== クイックリンク ===== */
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.quick-links button {
  padding: 10px 18px;
  font-size: 14px;
  border: 1px solid #c0c8d4;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  color: #305496;
  font-weight: bold;
  min-width: 130px;
}

.quick-links button:hover {
  background: #eef3fb;
  border-color: #305496;
}
