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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f4f8;
  color: #1e293b;
  min-height: 100vh;
}

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

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 16px;
  text-align: center;
}

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

/* タブ */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #e2e8f0;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tab.active {
  background: #2563eb;
  color: #fff;
}

.tab-content {
  display: none;
}

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

/* カード */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* フォーム */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 500;
}

.form-group input {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #2563eb;
}

/* ボタン */
.btn-primary {
  width: 100%;
  padding: 10px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  width: 100%;
  padding: 10px;
  background: #e2e8f0;
  color: #475569;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-icon {
  background: none;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #475569;
}

/* 入居者一覧 */
.tenant-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tenant-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  position: relative;
}

.tenant-card.alert-renew {
  border-left: 4px solid #f59e0b;
}

.tenant-card.alert-overdue {
  border-left: 4px solid #ef4444;
}

.tenant-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.room-no {
  font-size: 1.1rem;
  font-weight: 700;
  color: #2563eb;
}

.tenant-name {
  font-size: 1rem;
  font-weight: 600;
}

.tenant-meta {
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-renew {
  background: #fef3c7;
  color: #92400e;
}

.badge-overdue {
  background: #fee2e2;
  color: #991b1b;
}

.tenant-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.btn-small {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 0.8rem;
  cursor: pointer;
  color: #475569;
}

.btn-small:hover {
  background: #e2e8f0;
}

.btn-small.danger {
  border-color: #fca5a5;
  color: #dc2626;
  background: #fff5f5;
}

.btn-small.danger:hover {
  background: #fee2e2;
}

/* 家賃確認 */
.month-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
}

.rent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rent-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rent-card.paid {
  opacity: 0.6;
}

.rent-info {
  flex: 1;
}

.rent-room {
  font-size: 1rem;
  font-weight: 700;
  color: #2563eb;
}

.rent-tenant {
  font-size: 0.88rem;
  color: #475569;
}

.rent-amount {
  font-size: 0.85rem;
  color: #64748b;
}

.btn-paid-toggle {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-paid-toggle.unpaid {
  background: #fee2e2;
  color: #991b1b;
}

.btn-paid-toggle.paid {
  background: #dcfce7;
  color: #166534;
}

/* 空状態 */
.empty-state {
  text-align: center;
  color: #94a3b8;
  padding: 32px 16px;
  font-size: 0.9rem;
}

/* モーダル */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}
