* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  font-size: 1.4rem;
  font-weight: bold;
  padding: 16px 0 12px;
  border-bottom: 2px solid #4a90d9;
  margin-bottom: 20px;
  color: #222;
}

h2 {
  font-size: 1rem;
  font-weight: bold;
  color: #444;
  margin-bottom: 12px;
}

/* 追加フォーム */
.add-form {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.form-group {
  margin-bottom: 12px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 4px;
}

input[type="text"],
input[type="date"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  color: #333;
  background: #fafafa;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="date"]:focus {
  border-color: #4a90d9;
  background: #fff;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 10px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #357abd;
}

/* リストセクション */
.list-section {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.badge {
  display: inline-block;
  background: #4a90d9;
  color: #fff;
  font-size: 0.75rem;
  font-weight: bold;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
}

.show-returned {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: #666;
  cursor: pointer;
}

.lend-list {
  list-style: none;
}

.lend-item {
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fafafa;
  transition: opacity 0.2s;
}

.lend-item.returned {
  opacity: 0.5;
  background: #f0f0f0;
}

.lend-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.lend-info {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-weight: bold;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lend-meta {
  font-size: 0.82rem;
  color: #777;
  margin-top: 3px;
}

.lend-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-return,
.btn-delete {
  padding: 5px 10px;
  border: none;
  border-radius: 5px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-return {
  background: #e6f4ea;
  color: #2e7d32;
}

.btn-return:hover {
  background: #c8e6c9;
}

.btn-return.undo {
  background: #fff3e0;
  color: #e65100;
}

.btn-return.undo:hover {
  background: #ffe0b2;
}

.btn-delete {
  background: #fdecea;
  color: #c62828;
}

.btn-delete:hover {
  background: #ffcdd2;
}

.empty-msg {
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
  padding: 20px 0;
}

/* スマホ調整 */
@media (max-width: 400px) {
  .lend-item-top {
    flex-direction: column;
  }
  .lend-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
