* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: #f8fafc;
  color: #1e293b;
  line-height: 1.6;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: #1e293b;
}

.subtitle {
  font-size: 13px;
  color: #64748b;
  margin: 4px 0 0;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease;
}

.btn:hover { background: #f1f5f9; }

.btn-primary {
  background: #1e293b;
  border-color: #1e293b;
  color: #fff;
}

.btn-primary:hover { background: #334155; }

.btn-danger {
  color: #dc2626;
  border-color: #cbd5e1;
}

.btn-danger:hover { background: #fef2f2; }

.btn-sm {
  padding: 7px 12px;
  font-size: 12.5px;
}

.toolbar {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.field-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

select, input[type="text"], input[type="time"], input[type="number"] {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #1e293b;
}

select:focus, input:focus {
  outline: none;
  border-color: #64748b;
  box-shadow: 0 0 0 2px rgba(100,116,139,.15);
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.month-label {
  font-size: 14px;
  font-weight: 600;
  min-width: 90px;
  text-align: center;
}

.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-head .name {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.card-head .meta {
  font-size: 12px;
  color: #94a3b8;
  margin: 2px 0 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 11.5px;
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
}

tbody td {
  padding: 5px 10px;
  border-top: 1px solid #f1f5f9;
  vertical-align: middle;
}

tbody tr.weekend { background: #f8fafc; }
tbody tr.weekend td.date { color: #dc2626; }

td.date { white-space: nowrap; color: #475569; }
td.work { font-weight: 600; color: #334155; }
td.overtime { font-weight: 600; }
td.overtime.has-overtime { color: #d97706; }
td.overtime.none { color: #cbd5e1; }

input[type="time"] { width: 110px; }
input[type="number"] { width: 70px; }
td.note-cell input { width: 100%; min-width: 120px; }

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 18px 20px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}

.summary .box {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
}

.summary .box .label {
  font-size: 11.5px;
  color: #94a3b8;
  margin: 0 0 4px;
}

.summary .box .value {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.summary .box.overtime .value { color: #d97706; }

.form-actions {
  padding: 16px 20px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.empty-state {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

.note {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 14px;
}

.flash {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.flash-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #16a34a;
}

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

/* ログイン・パスワード変更画面 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #f8fafc;
}

.login-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 32px 28px;
  width: 100%;
  max-width: 360px;
}

.login-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
  color: #1e293b;
  text-align: center;
}

.login-lead {
  font-size: 13px;
  color: #64748b;
  text-align: center;
  margin: 0 0 20px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: #475569;
  font-weight: 500;
}

.login-form input {
  width: 100%;
}

.login-btn {
  width: 100%;
  justify-content: center;
  margin-top: 6px;
  padding: 10px 16px;
}

.back-link {
  display: block;
  text-align: center;
  margin-top: 18px;
  font-size: 12.5px;
  color: #64748b;
  text-decoration: none;
}

.back-link:hover { color: #1e293b; }

/* 従業員管理画面 */
.employee-add-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 16px;
  padding: 18px 20px;
  align-items: end;
}

.employee-add-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: #475569;
  font-weight: 500;
}

.employee-add-form .checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

.employee-add-form button {
  grid-column: 1 / -1;
  justify-self: start;
}

.inline-form {
  display: flex;
  gap: 6px;
}

.inline-form input[type="password"] {
  width: 140px;
}

button[disabled] {
  opacity: .4;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .summary { grid-template-columns: 1fr; }
  table { font-size: 12px; }
  input[type="time"] { width: 90px; }
  .employee-add-form { grid-template-columns: 1fr; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; max-width: 100%; }
  .card { border: none; }
}
